Javascript 收到一份;喷油器:Moduler“;尝试插入UI路由器时出错 “严格使用”; angular.module('confusionApp',['ui.router'])) .config(函数($stateProvider,$urlRouterProvider){ $stateProvider //主页的路径 .state('应用程序'{ url:“/”, 观点:{ “标题”:{ templateUrl:'views/header.html' }, “内容”:{ 模板:“待完成”, 控制器:“IndexController” }, “页脚”:{ templateUrl:'views/footer.html' } } }) //aboutus页面的路由 .state('app.aboutus'{ 网址:'aboutus', 观点:{ “内容”:{ 模板:“待完成” } } }) //contactus页面的路由 .state('app.contactus'{ 网址:'contactus', 观点:{ “内容”:{ templateUrl:'views/contactus.html', 控制器:“ContactController” } } }) //菜单页面的路径 .state('应用程序菜单'{ url:'菜单', 观点:{ “内容”:{ templateUrl:'views/menu.html', 控制器:“菜单控制器” } } }) //dishdetail页面的路径 .state('应用程序详细信息'{ url:'menu/:id', 观点:{ “内容”:{ templateUrl:'views/dishdail.html', 控制器:“DishDetailController” } } }); $urlRouterProvider。否则('/'); });
对于我尝试使用UI路由器的app.js文件,我使用bower为UI路由器安装角度依赖项。当我将它们包含在标记中时,它们当前具有正确的路径。我检查以确保文件也在bower_组件文件中。但是,当我运行程序时,什么也不显示,我收到的唯一错误是“未捕获错误:[$injector:modulerr]”错误。在加载脚本之前尝试加载ui.router:Javascript 收到一份;喷油器:Moduler“;尝试插入UI路由器时出错 “严格使用”; angular.module('confusionApp',['ui.router'])) .config(函数($stateProvider,$urlRouterProvider){ $stateProvider //主页的路径 .state('应用程序'{ url:“/”, 观点:{ “标题”:{ templateUrl:'views/header.html' }, “内容”:{ 模板:“待完成”, 控制器:“IndexController” }, “页脚”:{ templateUrl:'views/footer.html' } } }) //aboutus页面的路由 .state('app.aboutus'{ 网址:'aboutus', 观点:{ “内容”:{ 模板:“待完成” } } }) //contactus页面的路由 .state('app.contactus'{ 网址:'contactus', 观点:{ “内容”:{ templateUrl:'views/contactus.html', 控制器:“ContactController” } } }) //菜单页面的路径 .state('应用程序菜单'{ url:'菜单', 观点:{ “内容”:{ templateUrl:'views/menu.html', 控制器:“菜单控制器” } } }) //dishdetail页面的路径 .state('应用程序详细信息'{ url:'menu/:id', 观点:{ “内容”:{ templateUrl:'views/dishdail.html', 控制器:“DishDetailController” } } }); $urlRouterProvider。否则('/'); });,javascript,html,angularjs,angular-ui-router,bower,Javascript,Html,Angularjs,Angular Ui Router,Bower,对于我尝试使用UI路由器的app.js文件,我使用bower为UI路由器安装角度依赖项。当我将它们包含在标记中时,它们当前具有正确的路径。我检查以确保文件也在bower_组件文件中。但是,当我运行程序时,什么也不显示,我收到的唯一错误是“未捕获错误:[$injector:modulerr]”错误。在加载脚本之前尝试加载ui.router: 'use strict'; angular.module('confusionApp', ['ui.router']) .config(function($s
'use strict';
angular.module('confusionApp', ['ui.router'])
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
// route for the home page
.state('app', {
url:'/',
views: {
'header': {
templateUrl : 'views/header.html'
},
'content': {
template : '<h1>To be Completed</h1>',
controller : 'IndexController'
},
'footer': {
templateUrl : 'views/footer.html'
}
}
})
// route for the aboutus page
.state('app.aboutus', {
url:'aboutus',
views: {
'content@': {
template: '<h1>To be Completed</h1>'
}
}
})
// route for the contactus page
.state('app.contactus', {
url:'contactus',
views: {
'content@': {
templateUrl : 'views/contactus.html',
controller : 'ContactController'
}
}
})
// route for the menu page
.state('app.menu', {
url: 'menu',
views: {
'content@': {
templateUrl : 'views/menu.html',
controller : 'MenuController'
}
}
})
// route for the dishdetail page
.state('app.dishdetails', {
url: 'menu/:id',
views: {
'content@': {
templateUrl : 'views/dishdetail.html',
controller : 'DishDetailController'
}
}
});
$urlRouterProvider.otherwise('/');
});
在加载脚本之前,请尝试加载ui.router:
'use strict';
angular.module('confusionApp', ['ui.router'])
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
// route for the home page
.state('app', {
url:'/',
views: {
'header': {
templateUrl : 'views/header.html'
},
'content': {
template : '<h1>To be Completed</h1>',
controller : 'IndexController'
},
'footer': {
templateUrl : 'views/footer.html'
}
}
})
// route for the aboutus page
.state('app.aboutus', {
url:'aboutus',
views: {
'content@': {
template: '<h1>To be Completed</h1>'
}
}
})
// route for the contactus page
.state('app.contactus', {
url:'contactus',
views: {
'content@': {
templateUrl : 'views/contactus.html',
controller : 'ContactController'
}
}
})
// route for the menu page
.state('app.menu', {
url: 'menu',
views: {
'content@': {
templateUrl : 'views/menu.html',
controller : 'MenuController'
}
}
})
// route for the dishdetail page
.state('app.dishdetails', {
url: 'menu/:id',
views: {
'content@': {
templateUrl : 'views/dishdetail.html',
controller : 'DishDetailController'
}
}
});
$urlRouterProvider.otherwise('/');
});
似乎angular找不到ui路由模块, 请记住将其包含在html中。用那样的东西
如果您使用的是鲍尔
对不起,我的英语太差了。我希望这对您有用。似乎angular找不到ui路由模块, 请记住将其包含在html中。用那样的东西
如果您使用的是鲍尔
对不起,我的英语太差了。我希望这对你有用。我也有类似的问题。修复了在配置函数中使用“$stateProvider”和“$urlRouterProvider”之前插入它们的问题,例如:
<!-- UI-Router -->
<script src="angular-ui-router.js"></script>
<script src="yourscript.js"></script>
我也有类似的问题。修复了在配置函数中使用“$stateProvider”和“$urlRouterProvider”之前插入它们的问题,例如:
<!-- UI-Router -->
<script src="angular-ui-router.js"></script>
<script src="yourscript.js"></script>