Thursday, 15 July 2010

angularjs - Angular JS app not building properly on Grunt Compile,(minification) works fine on Grunt watch/build -



angularjs - Angular JS app not building properly on Grunt Compile,(minification) works fine on Grunt watch/build -

i trying compile application uses angular js (ngbp boilerplate). i'm new angular , spa concept. relatively simple app, setup built grunt. issue weird - when grunt watch, application builds fine , works perfectly. if grunt compile, of stuff in app don't work.

for example, urls kid modules using states utilize ui-router not load. there no errors on console. controllers have inline dependency injection

eg.controller( 'app.submodule', ['$scope','localstorageservice','$http','$rootscope','$stateparams', function($scope,localstorageservice,$http,$rootscope,$stateparams) {.......})]);

is there other known issue caused minification?

edit: did debugging , looks particular module not working upon minification. rest of modules loading fine. code module is:

http://pastebin.com/6l0pr4bq

edit2: tried using ngmin advised, doesn't seem resolving issue. module fails load. others loading fine. sense issue in code module. tried manually annotating functions, can seen pastebin code paste.

could tell me i'm doing wrong?

the main problem can minification di annotations functions - before minification functions dependency injection should annotated manually. not controllers - module run , config, directives, services, filtes...

when using grunt cases can done automatically using grunt-ngmin.

if need illustration ho configure - take @ yeoman/generator-angular

you need annotate resolves states - because not automatically annotated ngmin. have: validstate , pmgetplan without annotations.

because resolves not annotated ui-router fails load state , default silent this...

you can add together event handler on $rootscope:

$rootscope.$on('$statechangeerror', function (event, tostate, toparams, fromstate, fromparams, error) { console.log('$statechangeerror', event, tostate, toparams, fromstate, fromparams, error); });

angularjs gruntjs bundling-and-minification minify

No comments:

Post a Comment