javascript - Angular deployment issue -
i have website uses angularbootstrapnavtree control. works fine me on local machine. on server, installed visual studio ( it's mvc5 ) , debugged error occurred on server not locally serialisation. now, when go url of webapi2 service, data returned. if browse page script ( in .js file ):
var app, deps; deps = ['angularbootstrapnavtree']; if (angular.version.full.indexof("1.2") >= 0) { deps.push('nganimate'); } app = angular.module('pvu', deps); app.controller('pvucontroller', function ($scope, $timeout, $http, $window) { $scope.doing_async = true; $scope.data = null; $http({ method: 'get', url: '/products/getproducts/' }). success(function (data, status, headers, config) { $scope.doing_async = false; return $scope.my_data = data; }). error(function (data, status, headers, config) { }); $scope.clickhandler = function (branch) { $scope.thedata = branch.data; $scope.$apply(); }; treedata_avm = [ { label: 'loading' } ]; $scope.my_data = treedata_avm; });
the page runs, , tree shows 'loading'. if set breakpoint, success function called , data there. but, moment controller callback called ( $scope.doing_async = true; ), error on console:
error: [$injector:unpr] http://errors.angularjs.org/1.2.14/$injector/unpr?p0=nprovider%20%3c-%20n%20%3c-%20abntreedirective @ error (native) @ http://67.214.99.130/bundles/angular?v=rhmttq27bhbkd8lyjqrrxd93x9dmqd7owtir-op3k8k1:1:6542 @ http://67.214.99.130/bundles/angular?v=rhmttq27bhbkd8lyjqrrxd93x9dmqd7owtir-op3k8k1:1:19418 @ object.i [as get] (http://67.214.99.130/bundles/angular?v=rhmttq27bhbkd8lyjqrrxd93x9dmqd7owtir-op3k8k1:1:18494) @ http://67.214.99.130/bundles/angular?v=rhmttq27bhbkd8lyjqrrxd93x9dmqd7owtir-op3k8k1:1:19493 @ (http://67.214.99.130/bundles/angular?v=rhmttq27bhbkd8lyjqrrxd93x9dmqd7owtir-op3k8k1:1:18494) @ object.r [as invoke] (http://67.214.99.130/bundles/angular?v=rhmttq27bhbkd8lyjqrrxd93x9dmqd7owtir-op3k8k1:1:18706) @ http://67.214.99.130/bundles/angular?v=rhmttq27bhbkd8lyjqrrxd93x9dmqd7owtir-op3k8k1:1:23593 @ array.foreach (native) @ r (http://67.214.99.130/bundles/angular?v=rhmttq27bhbkd8lyjqrrxd93x9dmqd7owtir-op3k8k1:1:6870)
i thought had non minified version of angular installed, error shows @ start of file, on 1 line , unreadable. link goes page says module not defined, checked, , $xxx objects valid inside method, , don't know define else...
i not sure if it's iis issue, because working inside visual studio, last deployment task, appreciate or advice.
thanks
angular handles di via string matching, need change this:
app.controller('pvucontroller', function ($scope, $timeout, $http, $window)
to this:
app.controller('pvucontroller', ['$scope', '$timeout', '$http', '$window', function ($scope, $timeout, $http, $window){ }]);
when application compiled debug=false in web.config bundles created concatenated , minified. concatenation not issue, minification (uglify) process renames parameters , string array notation how angular reconciles dependencies because strings minification process ignore them allowing dependencies resolved correctly.
Comments
Post a Comment