Here's a plunker: http://plnkr.co/edit/aCENMy9ceQ8szHydUTuA

In the index you'll see the app is called SampleApp, and sets up a 
SampleAppCtrl on the <body> node.
Within >body> there's a partial imported (<div 
ng-include="'_header.html'"></div>, which has a HeaderCtrl associated),
and then the canonical <div ng-view></div>
On the home page, I display a list of sandwiches, and you can click each to 
access a view with the details of the selected sandwich.

The list of sandwiches is picked up via a ConfigSrvc service that reads a 
config.json file.
I also have a StateSrvc to try and keep track of the app "state" (currently 
just what the 'selected' sandwich is)

So.. in the Header (_header.html, HeaderCtrl.js) I'd like to display a 
label that is "Pick a Sandwich" when no sandwich is selected, and the 
selected sandwich label when one is selected.
I tried to do this by setting up a $watch in the HeaderCtrl but it seems 
that when I pick a sandwich, that watch is not notified.

You can see messages int he console.debug to follow the sequence of 
operations.

What am I missing / doing wrong?
What does the wngular way recommend instead ?
Thanks in advance,
F.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to