WARNING: Tried to load angular more than once. Angular JS

后端 未结 23 1507
有刺的猬
有刺的猬 2020-12-01 13:57

I am trying to view my app after running Grunt Build. I use grunt serve:dist to see all production ready build but in the browser I get an infinite loop saying:

23条回答
  •  醉酒成梦
    2020-12-01 14:02

    You must change angular route '/'! It is a problem because '/' base url request. If you change '/' => '/home' or '/hede' angular will good work. Sample:

    Module.Js:

    var application = angular.module('flow', ['ngRoute', 'ngResource']);
    

    RouteConfig.Js:

    angular.module('flow')
        .config(['$routeProvider', function ($routeProvider) {
            $routeProvider
                .when('/home', { templateUrl: '/home/index', controller: 'HomeController' })
                .when('/error', { templateUrl: '/Error/Index', controller: 'ErrorController' })
                .when('/login', { templateUrl: '/Account/Login', controller: 'AccountController' });
        }]);
    

提交回复
热议问题