Skip to content

Instantly share code, notes, and snippets.

@wcc526
Created March 15, 2015 08:29
Show Gist options
  • Select an option

  • Save wcc526/b75e4a101c813003715b to your computer and use it in GitHub Desktop.

Select an option

Save wcc526/b75e4a101c813003715b to your computer and use it in GitHub Desktop.
circle.drv.js
.directive('myCircle',function(){
return {
templateUrl: 'circle.html',
replace: true,
controller: ['$scope','$rootScope',function($scope,$rootScope){
$scope.afterClick = function(){
console.log('clicked');
$rootScope.$broadcast('clicked');
}
}],
link: function(scope,element){
element.on('click',function(){
scope.$apply(function(){
scope.afterClick();
});
});
}
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment