Skip to content

Instantly share code, notes, and snippets.

@alexo
Created December 13, 2012 21:34
Show Gist options
  • Save alexo/4280167 to your computer and use it in GitHub Desktop.
Save alexo/4280167 to your computer and use it in GitHub Desktop.

Revisions

  1. alexo created this gist Dec 13, 2012.
    15 changes: 15 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    myModule.directive('myComponent', function(mySharedService) {
    return {
    restrict: 'E',
    controller: function($scope, $attrs, mySharedService) {
    $scope.$on('handleBroadcast', function() {
    $scope.message = 'Directive: ' + mySharedService.message;
    });
    },
    replace: true,
    template: '<input>'
    };
    });


    <my-component ng-model="message"></my-component>