嗨,我在 IIS 服务器上发布 AngularJS 应用程序后出现了问题我相信这与 javascript 混淆和缩小有关,但我不知道如何解决它......
这就是我的 app.js 的样子
angular.module('app', ['LocalStorageModule', 'angular-loading-bar', 'smart-table', 'mgcrea.ngStrap', 'ngAnimate', 'ngSanitize', 'ngRoute', 'ui.router', 'LocalStorageModule', 'app.filters', 'app.services', 'app.directives', 'app.controllers'])
.config(['$stateProvider', '$locationProvider', function ($stateProvider, $locationProvider) {
$stateProvider
.state('home', {
url: '/',
layout: 'basic',
templateUrl: 'views/index',
controller: 'HomeCtrl'
})
.state('putninalozi', {
url: '/putninalozi',
layout: 'basic',
templateUrl: 'views/PutniNalozi',
controller: 'PutniNaloziCtrl'
})
.state('profil', {
url: '/profil',
layout: 'basic',
templateUrl: 'views/profil',
controller: 'ProfilCtrl'
})
.state('login', {
url: '/login',
layout: 'basic',
templateUrl: 'views/login',
controller: 'LoginCtrl'
})
.state('signup', {
url: '/signup',
layout: 'basic',
templateUrl: 'views/signup',
controller: 'SignUpCtrl'
})
.state('otherwise', {
url: '*path',
templateUrl: 'views/404',
controller: 'Error404Ctrl'
});
$locationProvider.html5Mode(true);
}])
.config(function ($httpProvider) {
$httpProvider.interceptors.push('authInterceptorService');
})
.run(['authService', '$templateCache', '$rootScope', '$state', '$stateParams', function (authService, $templateCache, $rootScope, $state, $stateParams) {
authService.fillAuthData();
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
}]);
例如,我的一个控制器看起来像这样
.controller('LoginCtrl', ['$scope', '$location', '$timeout', '$window', 'authService', function ($scope, $location, $timeout, $window, authService) {
$scope.loginData = {
userName: "",
password: ""
};
$scope.message = "";
$scope.login = function () {
authService.login($scope.loginData).then(function (response) {
$location.path('/putninalozi');
},
function (err) {
$scope.message = err.error_description;
});
};
}])
知道如何解决这个问题吗?谢谢大家的意见
我的 BundleCONfig.cs 看起来像这样
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new StyleBundle("~/content/css/app").Include("~/content/app.css")
.Include("~/content/custom.css")
.Include("~/content/loading-bar.css"));
// bundles.Add(new ScriptBundle("~/js/jquery").Include("~/scripts/vendor/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/js/app").Include(
"~/scripts/vendor/angular.min.js",
"~/scripts/vendor/smart-table.js",
"~/scripts/vendor/angular-strap.min.js",
"~/scripts/vendor/angular-strap.tpl.min.js",
"~/scripts/app.js",
"~/scripts/vendor/jquery-2.0.3.min.js",
"~/scripts/vendor/angular-ui-router.js",
"~/scripts/vendor/loading-bar.js",
"~/scripts/vendor/angular-animate.js",
"~/scripts/vendor/angular-route.js",
"~/scripts/vendor/angular-sanitize.min.js",
"~/scripts/vendor/angular-local-storage.min.js",
"~/scripts/vendor/bootstrap.js",
"~/scripts/controllers.js",
"~/scripts/filters.js",
"~/scripts/services.js",
"~/scripts/directives.js"));
}
}