Gaurav Bhusare Gaurav Bhusare - 6 months ago 23
AngularJS Question

Path to the JS file getting disappeared

I am using node server to execute project. For executing projectevery time my process is execute following 3 commands in cmd

npm install

node server

grunt serve


I used pagination directive from Git-hub in my project, but the problem arising is that every time I initialize the project above way, the path given to pagination.js file gets disappear from index.html. I added this pagination module using

bower install angular-utils-pagination


I tried this with --save also, but the

<script src="assets/lib/angular-utils-pagination/dirPagination.js"></script>


this line is getting disappeared every time I start project, and I need to enter it manually.

Will you please help me solving this problem?

Answer

I see the problem. Like I state on the comment. you putting the script tag on wiredep scope build.

index.html

<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="assets/lib/jquery/dist/jquery.js"></script>
<script src="assets/lib/angular/angular.js"></script>
<script src="assets/lib/angular-animate/angular-animate.js"></script>
<script src="assets/lib/angular-aria/angular-aria.js"></script>
<script src="assets/lib/angular-cookies/angular-cookies.js"></script>
<script src="assets/lib/angular-messages/angular-messages.js"></script>
<script src="assets/lib/angular-resource/angular-resource.js"></script>
<script src="assets/lib/angular-route/angular-route.js"></script>
<script src="assets/lib/angular-sanitize/angular-sanitize.js"></script>
<script src="assets/lib/angular-toastr/dist/angular-toastr.tpls.js"></script>
<script src="assets/lib/angular-touch/angular-touch.js"></script>
<script src="assets/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="assets/lib/angular-utils-pagination/dirPagination.js"></script>

<!-- endbower -->
<!-- endbuild -->

move your script tag after endbuild, then try to running 'grunt serve' again

...
<script src="assets/lib/angular-touch/angular-touch.js"></script>
<script src="assets/lib/bootstrap/dist/js/bootstrap.js"></script>

<!-- endboser -->
<!-- endbuild -->
<script src="assets/lib/angular-utils-pagination/dirPagination.js"></script>

if you want it automatic build on wiredep process then add that on karma.conf.js I think it locate on test directory. if you could provide me that file, I will show you how.