Javascript 角度UI路由重新加载模板

Javascript 角度UI路由重新加载模板,javascript,angularjs,Javascript,Angularjs,我使用的是angular ui路由,但当嵌套它时,它会不断地反复加载主索引文件,我想,我在Visual Studio中工作,当我转到该页面时,它开始滞后,但其他页面没有问题 这是路由中的代码: $stateProvider .state("stateOne", { url: "/stateOne", templateUrl: "/routesDemo/one" }) .state("stateTwo", { url: "/

我使用的是angular ui路由,但当嵌套它时,它会不断地反复加载主索引文件,我想,我在Visual Studio中工作,当我转到该页面时,它开始滞后,但其他页面没有问题

这是路由中的代码:

$stateProvider
    .state("stateOne", {
        url: "/stateOne",
        templateUrl: "/routesDemo/one"

    })
    .state("stateTwo", {
        url: "/stateTwo?donuts",
        templateUrl: function(params) { return "/routesDemo/two?donuts=" + params.donuts; }
    })
    .state("stateThree", {
        url: "/stateThree",
        templateUrl: "/routesDemo/three"

    })
    .state("stateAllProducts", {
        url: "/Products",
        templateUrl: "/product/all",
        controller: ProductJsController

    })
    .state("loginRegister", {
        url: "/loginRegister?returnUrl",
        views: {
            "": {
                templateUrl: "/Account/LoginRegister",
            },
            "login@loginRegister": {
                templateUrl: "/Account/Login",
                controller: LoginController
            },
            "register@loginRegister": {
                templateUrl: "/Account/Register",
                controller: RegisterController
            }
        }
    });
LoginRegister的内容如下:

<div ui-view="login"></div>

<div ui-view="register"></div>
登录

登记册

<form ng-submit="register()">
    <label for="emailAddress">Email Address:</label>
    <input id="emailAddress" type="text" ng-model="registerForm.emailAddress" required/>

    <label for="password">Password:</label>
    <input id="password" type="password" ng-model="registerForm.password" required/>

    <label for="confirmPassword">Confirm Password:</label>
    <input id="confirmPassword" type="password" ng-model="registerForm.confirmPassword" required/>

    <button type="submit">Register</button>
</form>

<div ng-if="loginForm.registrationFailure">
    D'oh!
</div>

请提供索引HTML文件。如果控制器未加载,则可能无法渲染视图。请同时提供一个控制器文件

您需要将控制器名称用引号括起来,就像它们在控制器中一样

.state("stateAllProducts", {
        url: "/Products",
        templateUrl: "/product/all",
        controller: ProductJsController
看起来应该是:

.state("stateAllProducts", {
        url: "/Products",
        templateUrl: "/product/all",
        controller: 'ProductJsController'
没有看到更多的代码,这是我能提供的最好的

.state("stateAllProducts", {
        url: "/Products",
        templateUrl: "/product/all",
        controller: 'ProductJsController'