I found the solution, not sure if its best practice but it does the trick. 
The idea is to set the variables needed as part of the onload method to 
abstract out the control as syntax.

    <div ng-include src='"/assets/includes/sub-header.html"' 
onload="brandModel = ctrl1.myModel;></div>


On Tuesday, 11 March 2014 08:41:48 UTC, James Morgan wrote:
>
> Hi all, we have been using the newish "Controller as" in a new application 
> and I am fairly pleased with it so far however I have a question which you 
> may be able to answer for me. 
>
> Firstly I have a few sections of my application which are the same on 
> every page, I would like to move these to a shared include. The problem I 
> have is that they are basically small templates with a few expressions in 
> i.e. printing someones name, displaying a statues etc. However I do not 
> understand how this can be achieve as all the views are being managed by 
> different controller i.e. a different alias and the expression is like 
> {{ctrlX.displayName }} where every view which I want to use these in has a 
> different controller alias. Does this make sense?
>
> I have thought I could do this as a directive but its seems over kill 
> since its not new HTML its just re-using a snippet of html.
>
> Do you know how I can use the same include on different pages which have 
> different controller alias?
>
> Many thanks in advance
>
> James
>

-- 
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/d/optout.

Reply via email to