Reputation: 624
I use angularjs v1.6.3. I got an error when assign a number to resolve's property of state.
.state('products-new', {
url: "/rent/whats-new/",
resolve: {
pageType: 2,
}
...
}
This is the error message i have got :
Error: ng:areq
Bad ArgumentArgument 'fn' is not a function, got number
Can anyone explain to me why this happen ?
Upvotes: 0
Views: 95
Reputation: 6739
As I said in my comment, Resolves should either be a function which returns the value or a string to a service that gets injected. For more information look at the documentation I've linked above. So change your code to the below and all should work.
.state('products-new', {
url: "/rent/whats-new/",
resolve: {
pageType: function () {
return 2;
},
}
}
Upvotes: 1