Sunday, 15 March 2015

javascript - Angular ui-router is not instantiated, giving an inject module error -


Hello, I have a strange problem with the angular UI-router I was about to update a webpage and do this Wish what happens with glass I've heard very good things about UI-Router but I'm not getting it to do this work. I'm following the tutorial how to set up the scene, but I get an error Is: Unkoot error: [$ Injector: m Dualer] failed to instantiate the application due to the module: TypeError: there is no undefined function

I am using the CDN to import the cooner and U-router . This is my exact code:

  & lt ;; Doctype html & gt; & Lt; Html ng-app = "fqmApp" & gt; & Lt; Top & gt; & Lt; Script src = "https://code.angularjs.org/1.3.9/angular.js" & gt; & Lt; / Script & gt; & Lt; Script src = "https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.13/angular-ui-router.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "app.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div ui-view & gt; & Lt; / Div & gt; & Lt; A ui-sref = "state1" & gt; State 1 & lt; / A & gt; & Lt; A ui-sref = "state2" & gt; State 2 & lt; / A & gt; & Lt; / Body & gt; & Lt; / Html & gt; Use "hard". Module ("fqmApp", ["ui.router"]). {($ State Provider, $ UrlRouterProvider) {// For any mismatched url, redirect / state1 $ urlRouterProvider.otherwhise ("/ state1"); // Now states $ stateProvider .state ('state1', {Url: set "/ state1", TemplateUrl: "partials / state1.html"}) .state ('state2', {url: "/ state2", templateUrl: "partials / state2.html"})}} Controller ("ctrl", function ($ scope) {$ scope.hello = "hello";})  

If I do not include config service code then everything works fine I'm not getting where I'm wrong here. The controller was just one test that works great. This is probably some silly mistake, but I'm looking at it for an hour or more.

Does anyone see a problem? thank you in advanced.

The problem with the code is that you have a typo, it otherwise Change this part instead of Other Vises :

  $ urlRouterProvider.otherwhise ("/ state1");  

In:

  $ urlRouterProvider.otherwise ("/ state1");  

No comments:

Post a Comment