2

Right, not an easy one to explain but I'll do my best.

I'm trying to make a directive that watches/uses data from an outer-directive (both currently elements).

If I don't use controllerAs syntax, this isn't an issue, as I can create a new isolated scope for my inner-directive picking the bits I want.

However, say for arguments sake, outer-directive has it's controllerAs 'vm' (as per normal) and has a property/value of 'name' - how would I then bind to it?

The obvious one was to try

scope : {
   name : '=vm.name'
}

But this just throws an error.

I've done a quick plnkr to try and explain:

http://plnkr.co/edit/VxUegDs7iweYVSHyAJKr?p=preview

I've tried various combinations of using

bindToController:true // from ng 1.3

and also assigning to and object

bindToController:{
    name : '='
} // ng 1.4

but no joy with either.

Adam Martin
  • 61
  • 1
  • 5
  • You want your inner directive to have an isolate scope correct? – KreepN Jul 08 '15 at 16:01
  • Yes, but I think I now understand it a bit more, I believe I need to require the controller of which the vm comes from and then assign the variables. Then I guess I need to watch those variables and assign to my local scope – Adam Martin Jul 10 '15 at 07:34

0 Answers0