首页 > 解决方案 > AngularJS 1.5 "Could not resolve '___' from state 'home'"

问题描述

I have looked at the other solutions. They basically state that you should be sure to include a call to the x.state.js file from the index.html file. I have that.

When I change the name of the state the error gets updated. So if I had a state called "mystate" and called it from a button's ui-sref it would say "Could not resolve 'mystate' from state 'home'. If I changed the ui-sref and the state name to "yourstate" the error message changes to "Could not resolve 'yourstate' from state 'home'. So I don't know where else to look.

Update with some code that I really just took from a website tutorial to test this out but here goes: myupload.state.js

    'use strict';
    angular.module('myApp')
      .config(function ($stateProvider){
       $stateProvider
       .state('upload',{
        parent: 'home',
        url: 'upload',
        data: {
          roles: [],
          pageTitle: 'Upload Your Files',
          displayName: 'Upload Your Files'
           },
        views: {
          'content@': {
            templateURL: 'my/path/myupload/upload.html',
            controller: 'UploadController'
               }
        },
        resolve: {}
        })
   }
);

There is a upload.directive.js file in the same directory. A uploadcontroller.js file in that same directory. And a upload.html file.

In the 'home' page HTML file I have a button with the following syntax. When clicked it is supposed to route you to the above page for a file upload.

<button class='btn' ui-sref='upload()'>

There are no other errors to troubleshoot with.

I have a couple of other states to look at and this one looks just like those.

Those buttons/states work.

Where else should I be looking?

标签: angularjs

解决方案


我的问题原来是需要特定于我正在处理(继承)的应用程序的安全代码:状态子句的部分。一旦我添加了该按钮就可以正常工作。


推荐阅读