Reputation: 702
I am using angular
and sails
to build a web app, in which each user have their own them so to display their public profile I have to use different templates. I am using ui-router
and if I can pass id passed to the route
url to templateUrl
field I can solve this problem easily, so is there a way to do that ??
app.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('profile', {
abstract: true,
url: '',
templateUrl: domain + "/profile/master",
controller: 'profileController'
})
.state('profile.user', {
url: '/user/:id',
templateUrl: domain + '/angular/profile/:id',
controller: 'privateProfileController'
});
});
Upvotes: 3
Views: 4144
Reputation: 1917
.state('contacts.detail', {
url: '/{contactId}',
views: {
'menu': {
templateUrl:
function (stateParams){
return '/partials/contacts.detail' + stateParams.contactId + '.html';
}
}
}
})
Upvotes: 3