angularjs - 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?
解决方案
我的问题原来是需要特定于我正在处理(继承)的应用程序的安全代码:状态子句的部分。一旦我添加了该按钮就可以正常工作。
推荐阅读
- sql-server - 多个 INSERT 语句与多个查询的 SQL Server 查询计划
- javascript - 您可以在浏览器控制台上抑制 SVG 错误的错误报告吗?
- python - Keras:是否有具有历史记录+进度的 train_on_batch 示例代码?
- javascript - Nuxt.js 动态组件错误“要么将模板预编译为渲染函数,要么使用编译器包含的构建”
- python - 如何在同一屏幕中显示列表视图以及如何制作搜索框以提供建议
- r - 为什么来自 forcats 的 fct_lump 无法处理我的数据?
- google-apps-script - 使用脚本在 Google 电子表格中自动增加 ID
- java - JPA - 具有嵌入 ID 的映射列表属性
- google-cloud-platform - Debian 9 上的 OpenCl 安装程序未检测到已安装的 lsb_core
- node.js - 将数据附加到 .json 文件