Saturday, 15 February 2014

javascript - Ui Router - nested view not showing up ($viewContentLoaded not fired) -



javascript - Ui Router - nested view not showing up ($viewContentLoaded not fired) -

views/index.jade:

extends layout block content div(ui-view)

views/partials/user.jade

h1 route 1 hr a(ui-sref=".profile") show content div(ui-view)

js/appstates.js

'use strict'; var app = angular.module('myapp'); app.config(['$stateprovider', '$urlrouterprovider', function($stateprovider, $urlrouterprovider) { $urlrouterprovider.otherwise("/user"); $stateprovider .state('user', { url: '/user', templateurl: 'partials/user' }) .state('user.profile', { url: '/profile', template: '<h1>my contacts</h1>' }) ; } ]);

'my contacts' never shows up. note link seems correct. not sure what's going on.

i tried following:

http://tech.endeepak.com/blog/2014/05/03/debugging-angular-ui-router/

and noticed '$viewcontentloaded' never called on nested view, not sure why. cases shouldn't called?

from quick help in irc channel, managed solved it.

the problem line 4 in jade file:

div(ng-view)

from reason jade default render empty attributes value equal name. result html was:

<div ng-view="ng-view"></view>

an easy prepare set empty value in jade

div(ng-view="")

and works.

thanks 1 time again people on @ irc.

javascript node.js angularjs angular-ui-router nested-views

No comments:

Post a Comment