[英]Angularjs ui-router with Materialize-angular issue
我想同時使用ui-router和angular-materialize,但是當我想添加angularmaterialize模塊時,它在控制台中向我顯示此錯誤:
錯誤:[$ injector:modulerr] ...
的script.js
var routerApp = angular.module("routerApp", ["ui.router"], ['ui.materialize']);
routerApp.controller('mainCtrl', ["$scope", function ($scope) {
$scope.select = {
value: "Option1",
choices: ["Option1", "I'm an option", "This is materialize", "No, this is Patrick."]
};
routerApp.config(
["$stateProvider", "$urlRouterProvider",
function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise("/template1");
$stateProvider
.state("template1", {
url: "/template1",
templateUrl: "template1.html",
controller: "tmp1Controller"
})
.state("template2", {
url: "/template2",
templateUrl: "template2.html",
controller: "tmp2Controller"
});
}
]);
routerApp.controller("mainCtrl", ["$scope",
function ($scope) {
}
]);
routerApp.controller("tmp1Controller", ["$scope",
function ($scope) {
}
]);
routerApp.controller("tmp2Controller", ["$scope",
function ($scope) {
}
]);
請告訴我我怎么了。 這是我在Plunker中的代碼
問題出在模塊定義中使用的語法錯誤。 它應該是
var routerApp = angular.module("routerApp", ["ui.router", "ui.materialize"]);
這意味着將模塊的依賴性指定為數組的元素,作為模塊定義的第二個參數,而不是不同的數組,即不是["ui.router"], ['ui.materialize']
而是["ui.router", "ui.materialize"]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.