The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Directive to Directive Communication in AngularJS

Directive to Directive Communication in AngularJS

8:01
In Angular JS, you can use one directive as an element and other directives as attributes to the element, allowing you to specify different functionality for elements based on the attributes in the element. This lesson shows you how to take a group of directive elements and give them each unique functionality based on their directive attributes.
Watch this lesson now
Avatar
egghead.io

In Angular JS, you can use one directive as an element and other directives as attributes to the element, allowing you to specify different functionality for elements based on the attributes in the element. This lesson shows you how to take a group of directive elements and give them each unique functionality based on their directive attributes.

Avatar
Roman Ganchenko

I wonder why my buttons don't have display:block property using @import foundation into my main.scss (scaffolded originally angular via yeoman)

In reply to egghead.io
Avatar
Harrison

Hi, why does $scope.abilities not save the values pushed into it when mouseenter? Such that having mouseenter into 'The Flash' does not produce ['flight', 'flight', 'flight']?

Avatar
Dominik

In video You expose controller from directive "superhero", but in JS BIn code it is exposed as "normal" controller ? I need to expose controller from directive , but got error " Controller 'xxx', required by directive 'yyy', can't be found!". What is ok and what is wrong ?

Avatar
Dominik

using require: "^controllerFromDirective" helped ( ^ which means "search above" ??? )

In reply to Dominik
Avatar
Jason

It doesn't do that because the elements are not pushed to the array on mousenter, they're pushed on the creation of the element.

If there was something like this it would be a different story:

$element.bind("mouseenter", function() {
superman.addSpeed();
console.log(superman.abilities);
});

In reply to Harrison
Avatar
George

Sorry for off-topic question, but how do you do that magic with quick text search and navigation between occurrences? Some kind plugin for WebStorm? Thanks

Avatar
Joel

cmd-shift-a will basically let you search for any action in WebStorm and cmd-e is a "recent files" dialog. I like to use both!

I didn't watch the lesson recently, but those are the two I use that might be what you're asking 😜

In reply to George
Avatar
Steven

In the JS bin code example - if I remove the directive scope object literal the behavior is actually identical! What is going on - I would have thought there would have been a bit of a mess!!!

In reply to egghead.io
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?