Created
March 3, 2015 15:39
-
-
Save pklink/067fcca3f0774f42be62 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/hikake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app="myApp"> | |
<head> | |
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<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-controller="myController"> | |
<p><my-el model="anyValue"></p> | |
<a ng-click="getValue()">get value</a> | |
<script id="jsbin-javascript"> | |
var app; | |
app = angular.module('myApp', []); | |
app.controller('myController', function($scope) { | |
$scope.anyValue = [1, 2]; | |
$scope.getValue = function() { | |
alert($scope.anyValue); | |
}; | |
}); | |
app.directive('myEl', function($timeout) { | |
return { | |
restrict: 'E', | |
template: '<input type="checkbox" />', | |
scope: { | |
model: '=' | |
}, | |
link: function(scope, element, attr) { | |
angular.element(element).on('click', function() { | |
$timeout(function() { | |
scope.model.push(3); | |
}); | |
}); | |
} | |
}; | |
}); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html ng-app="myApp"> | |
<head> | |
<script src="//code.jquery.com/jquery-2.1.1.min.js"><\/script> | |
<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-controller="myController"> | |
<p><my-el model="anyValue"></p> | |
<a ng-click="getValue()">get value</a> | |
</body> | |
</html></script> | |
<script id="jsbin-source-javascript" type="text/javascript">var app; | |
app = angular.module('myApp', []); | |
app.controller('myController', function($scope) { | |
$scope.anyValue = [1, 2]; | |
$scope.getValue = function() { | |
alert($scope.anyValue); | |
}; | |
}); | |
app.directive('myEl', function($timeout) { | |
return { | |
restrict: 'E', | |
template: '<input type="checkbox" />', | |
scope: { | |
model: '=' | |
}, | |
link: function(scope, element, attr) { | |
angular.element(element).on('click', function() { | |
$timeout(function() { | |
scope.model.push(3); | |
}); | |
}); | |
} | |
}; | |
}); | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app; | |
app = angular.module('myApp', []); | |
app.controller('myController', function($scope) { | |
$scope.anyValue = [1, 2]; | |
$scope.getValue = function() { | |
alert($scope.anyValue); | |
}; | |
}); | |
app.directive('myEl', function($timeout) { | |
return { | |
restrict: 'E', | |
template: '<input type="checkbox" />', | |
scope: { | |
model: '=' | |
}, | |
link: function(scope, element, attr) { | |
angular.element(element).on('click', function() { | |
$timeout(function() { | |
scope.model.push(3); | |
}); | |
}); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment