JSFiddle

  • Angular 15

    Directive to Directive Communication from egghead.io - Scope example

    var app = angular.module("superApp", []);
    //https://egghead.io/lessons/angularjs-directive-to-directive-communication
    
    app.directive("superhero", function() {
        return {
            restrict: "E",
            scope: {}, //overide so ...
  • Angular 14

    Directives Talking to Controllers from egghead.io - using controller and directives

    var app = angular.module("TwitterApp", [])
    
    app.controller("AppCtrl", function ($scope) {
        $scope.loadMoreTweets = function() {
            alert("Loading Tweets");
        }
        
        $scope.deleteTweets = function() {
            alert ...
  • Angular 13

    Useful Behaviours from egghead.io - using scope, element and attrs

    var app = angular.module("behaviorApp", [])
    
    //mouse over
    app.directive("enter", function () {
        return function (scope, element, attrs) {
            element.bind("mouseenter", function ...
  • Angular 12

    Basic Behaviours from egghead.io mouse enter and leave

    var app = angular.module("behaviorApp", [])
    
    //mouse over
    app.directive("enter", function () {
        return function (scope, element) {
            element.bind("mouseenter", function() {
                console ...
  • Angular 11

    Difference between different directive types - from egghead.io

    var app = angular.module("superhero", [])
    
    app.directive("superman", function() {
        return {
            restrict: "A",
            link: function() {
                alert("I am working stronger")
            }
        }
    })
    
    app ...
  • Angular 10 #12 is the latest revision

    from egghead.io this is a basic directive example

    var app = angular.module("superhero", [])
    
    app.directive("superman", function() {
        return {
            restrict: "E",
            template: "<div>Here I am to save the day</div>"
        }
    
    })
  • 1
  • 2