angularjs - Add component inside another component ui-view -
after login form change view home page
this home.js
import homecomponent './home.component'; import listtemplatescomponent 'listtemplates/listtemplates.component'; import angular 'angular'; import uirouter 'angular-ui-router'; angular.module('home',[ uirouter ]) .config(($stateprovider, $urlrouterprovider)=> { "nginject"; $urlrouterprovider.otherwise('/home'); $stateprovider .state('listtemplates', { url: '/home', component: 'listtemplates' }); }) .component('home',homecomponent) .component('listtemplates',listtemplatescomponent);
home.html
<h3>home</h3> <h1>menu</h1> <div ui-view></div>
i want when show home page want show default listtemplates
import listtemplatescomponent './listtemplates.component'; import angular 'angular'; import uirouter 'angular-ui-router'; angular.module('listtemplates',[ uirouter ]) .config(($stateprovider, $urlrouterprovider)=> { "nginject"; }) .component('listtemplates',listtemplatescomponent);
with code working , dont have error
how have default listtemplates inside of home when redirect home thanks
should configure imbrication ,inside of app.js ??
try change
$urlrouterprovider.otherwise('/home');
to
$urlrouterprovider.otherwise(function($injector, $location) { $location.path('/home'); });
or
use this.
$urlrouterprovider.otherwise('home'); $stateprovider .state('home', { url: '/home', component: 'listtemplates' });
Comments
Post a Comment