I want to use ui-router and angular-materialize together, but when I want to add angular materialize module, it show me this error in console :
Error: [$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) {
}
]);
Please show me what is my wrong. Here is my code in Plunker
The issue is with the wrong syntax that you are using in module definition. It should be
var routerApp = angular.module("routerApp", ["ui.router", "ui.materialize"]);
which means that the dependencies for the modules are specified as elements of array as second argument to module definition not as different arrays i-e not as ["ui.router"], ['ui.materialize']
but like ["ui.router", "ui.materialize"]