javascript - Angular ui-router is not instantiated, giving an inject module error -
hello have weird problem angular ui-router. renew webapp , want angular. have heard lot of things ui-router not getting work. following tutorial on how set views, error: uncaught error: [$injector:modulerr] failed instantiate module fqmapp due to: typeerror: undefined not function
i using cdn's import angular , ui-router. exact code:
<!doctype html> <html ng-app="fqmapp"> <head> <script src="https://code.angularjs.org/1.3.9/angular.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.13/angular-ui-router.min.js"></script> <script src="app.js"></script> </head> <body> <div ui-view> </div> <a ui-sref="state1">state 1</a> <a ui-sref="state2">state 2</a> </body> </html>
js
"use strict" angular.module("fqmapp", ["ui.router"]) .config(function ($stateprovider, $urlrouterprovider) { //for unmatched url, redirect /state1 $urlrouterprovider.otherwhise("/state1"); //now set states $stateprovider .state('state1', { url: "/state1", templateurl: "partials/state1.html" }) .state('state2', { url: "/state2", templateurl: "partials/state2.html" }); }) .controller("ctrl", function ($scope) { $scope.hello="hello"; })
everything works fine if don't include config service code. not getting going wrong here. controller test. works fine. silly mistake have been looking @ hour or more now.
does see problem? in advance.
the problem code have typo, should otherwise instead of otherwhise change part:
$urlrouterprovider.otherwhise("/state1");
in this:
$urlrouterprovider.otherwise("/state1");
Comments
Post a Comment