Recently I've started with Angular JS and I've created some routes that worked for some time. I'm not sure if I have done something wrong or not, but I'm getting a strange error and I'm not really sure what's wrong.
Here is the code:
im instantiating my app the normal way
var app = angular.module("upbis", ['ngRoute']);
This is the error:
https://docs.angularjs.org/error/$injector/modulerr?p0=upbis&p1=Error:%20%5B$injector:nomod%5D%20http:%2F%2Ferrors.angularjs.org%2F1.3.0-beta.17%2F$injector%2Fnomod%3Fp0%3Dupbis%0A%20%20%20%20
I really went through many solutions here on Stack but I couldn't find anything that solves my problem. Lost hours and couldn't find what's wrong.
It seems to be a problem with dependency injection, I would recommend you to use a different approach injecting on controllers and config:
app.config(['$httpProvider',function($routeProvider) {
$routeProvider.when('/', {
templateUrl: "templates/feed.html",
controller: 'FeedController'
})
.when('/bblog', {
templateUrl: "templates/bblog.html",
controller: 'BblogController'
})
.when('/marketplace', {
templateUrl: "templates/marketplace.html",
controller: 'MarketplaceController'
})
.otherwise({ redirectTo: '/' });
}]);
app.controller('FeedController', ['$scope', function($scope) {
}]);
(repeat this pattern for your other controllers as well)
Try this out and let me know, this way is minification safe, and it's probably whats messing with you.
Hope that helps, thanks.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments