AngularJS Router and ui-view -


hi have having trouble getting router work. have created page called lookup.html , i've added router file, it's not loading in ui-view when go url i've specified in router. i've created plnkr , hope help.

http://plnkr.co/edit/ii7mv7jnyenhjhkx1ht5?p=linter

here's router:

(function () { 'use strict';  angular     .module('crm.ma')     .config(config);  config.$inject = ['$stateprovider', '$urlrouterprovider'];  function config($stateprovider, $urlrouterprovider) {     $stateprovider         .state('login', {             url: '/login?token',             data: {                 skipauth: true             },             resolve: {                 valid: function (authservice, $stateparams, sessionservice, $state) {                     if (!sessionservice.getsession()) {                         if ($stateparams.token) {                             sessionservice.setsession($stateparams.token);                         } else {                             sessionservice.removesession();                         }                     }                     authservice.login();                 }             }         })          .state('main', {             abstract: true,             templateurl: 'app/components/common/layout.html',             controller: 'maincontroller vm',             data: {                 pagetitle: 'homepage'             }         })         .state('main.index', {             url: '/',             templateurl: 'app/main/main.html',             controller: 'maincontroller vm',             data: {                 pagetitle: 'homepage'             }         })                     .state('search', {             url: '/search',             templateurl: 'app/advancedsearch/advanced-search.html',             controller: 'advancedsearch.controller vm',             data: {                 pagetitle: 'search'             }          })         .state('lookup', {             url: '/lookup',             templateurl: 'app/components/common/lookup.html',             controller: 'lookupctrl vm',             data: {                 pagetitle: 'look up'             }          })         .state('dealer', {             url: '/dealer',             templateurl: 'app/components/common/layout.html',             controller: 'dealercontroller vm',             data: {                 pagetitle: 'dealer'             }         });;     $urlrouterprovider.otherwise('/'); } })(); 

and here lookup.html page.

<div> <div>lookup results</div> <table>     <thead>         <tr>             <td>acc. id</td>             <td>acc. name</td>             <td>acc address</td>             <td>city</td>             <td>zip</td>             <td>phone</td>             <td>parent name</td>             <td>account type</td>             <td>account status</td>             <td>credit term</td>         </tr>     </thead>     <tbody>         <tr ng-repeat="result in vm.results">             <td>{{ result.accountid }}</td>             <td>{{ result.accountname }}</td>             <td>{{ result.address }}</td>             <td>{{ result.city }}</td>             <td>{{ result.state }}</td>             <td>{{ reuslt.zip }}</td>             <td>{{ result.phone }}</td>             <td>{{ result.parentname }}</td>             <td>{{ result.accounttype }}</td>             <td>{{ result.accountstatus }}</td>             <td>{{ result.accountstatus }}</td>             <td>{{ result.creditterm }}</td>         </tr>     </tbody> </table> 

if further info needed please let me know. didn't write this, , i'm still little unsure on how use router.

maybe has imported angular-route.js , not angular-ui-route.js; differents. angular-route.js should use:

<div ng-view></div> 

and in angular-ui-route.js should use:

<div ui-view></div> 

another problem maybe first line of router file, should like:

'use strict';    angular.module(......... 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -