Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angularjs ui-router parent state

Tags:

angularjs

Using angularjs and ui-router can I:

A.) Define custom variables when defining my state (see 'data' below). I currently do this with success, wanted to make sure its proper.

.state('parent', {url:'/parent', templateUrl: 'views/parent.html', abstract: true, data: {stuff: 'stuff'}})

B.) Have my child state inherit that variable data ( How? )

.state('parent.child',   {url:'/child', templateUrl: 'views/parent.child.html', data: parent.data})

?

like image 894
Meeker Avatar asked May 21 '13 03:05

Meeker


1 Answers

You don't specify "data" into the child state, is already inherited from parent/abstracted state. You access it by :

$state.current.data
like image 63
IceDevil Avatar answered Oct 10 '22 12:10

IceDevil