Skip to content

Instantly share code, notes, and snippets.

@pragyandas
Created January 22, 2015 16:33
Show Gist options
  • Save pragyandas/454403e675c77c08648a to your computer and use it in GitHub Desktop.
Save pragyandas/454403e675c77c08648a to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body ng-app='myApp'>
<div ng-controller='firstController'>
<div>{{fullName}}</div>
<my-directive name='name' callback-fn="getFullName(FirstName)"></my-directive>
</div>
<script id="jsbin-javascript">
var app=angular.module('myApp',[]);
app.controller('firstController',function($scope){
$scope.name='Pragyan';
$scope.getFullName=function(arg){
alert(arg);
};
});
app.directive('myDirective',function(){
return {
restrict:'EA',
scope:{
name:'=',
someCtrlFn:'&callbackFn'
},
template:"<button ng-click=someCtrlFn({FirstName:'Pragyan'})>Click</button>"
};
});
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"><\/script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body ng-app='myApp'>
<div ng-controller='firstController'>
<div>{{fullName}}</div>
<my-directive name='name' callback-fn="getFullName(FirstName)"></my-directive>
</div>
</body>
</html></script>
<script id="jsbin-source-javascript" type="text/javascript">var app=angular.module('myApp',[]);
app.controller('firstController',function($scope){
$scope.name='Pragyan';
$scope.getFullName=function(arg){
alert(arg);
};
});
app.directive('myDirective',function(){
return {
restrict:'EA',
scope:{
name:'=',
someCtrlFn:'&callbackFn'
},
template:"<button ng-click=someCtrlFn({FirstName:'Pragyan'})>Click</button>"
};
});</script></body>
</html>
var app=angular.module('myApp',[]);
app.controller('firstController',function($scope){
$scope.name='Pragyan';
$scope.getFullName=function(arg){
alert(arg);
};
});
app.directive('myDirective',function(){
return {
restrict:'EA',
scope:{
name:'=',
someCtrlFn:'&callbackFn'
},
template:"<button ng-click=someCtrlFn({FirstName:'Pragyan'})>Click</button>"
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment