Created
August 12, 2015 01:27
-
-
Save anonymous/839b864e4e0b70281153 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/zomamupose
This file contains hidden or 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> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body ng-app="APP"> | |
<div ng-controller="ctrl"> | |
<div scope-test | |
one-way="oneWay(name)" | |
two-way="twoWay" | |
></div> | |
</div> | |
<script id="jsbin-javascript"> | |
angular.module('APP', []) | |
.controller('ctrl', ctrl) | |
.directive('scopeTest', scopeTest) | |
function ctrl ($scope) { | |
$scope.oneWay = function (name) { | |
console.log('hello ' + name) | |
} | |
$scope.twoWay = function (name) { | |
console.log('hello ' + name) | |
} | |
} | |
function scopeTest () { | |
var scope = { | |
oneWay: '&', | |
twoWay: '=' | |
} | |
function link (scope) { | |
scope.oneWay('BOB') | |
scope.oneWay({name: 'BOB'}) | |
scope.twoWay('JAMES') | |
} | |
return { | |
scope: scope, | |
restrict: 'A', | |
link: link | |
} | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">angular.module('APP', []) | |
.controller('ctrl', ctrl) | |
.directive('scopeTest', scopeTest) | |
function ctrl ($scope) { | |
$scope.oneWay = function (name) { | |
console.log('hello ' + name) | |
} | |
$scope.twoWay = function (name) { | |
console.log('hello ' + name) | |
} | |
} | |
function scopeTest () { | |
var scope = { | |
oneWay: '&', | |
twoWay: '=' | |
} | |
function link (scope) { | |
scope.oneWay('BOB') | |
scope.oneWay({name: 'BOB'}) | |
scope.twoWay('JAMES') | |
} | |
return { | |
scope: scope, | |
restrict: 'A', | |
link: link | |
} | |
}</script></body> | |
</html> |
This file contains hidden or 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
angular.module('APP', []) | |
.controller('ctrl', ctrl) | |
.directive('scopeTest', scopeTest) | |
function ctrl ($scope) { | |
$scope.oneWay = function (name) { | |
console.log('hello ' + name) | |
} | |
$scope.twoWay = function (name) { | |
console.log('hello ' + name) | |
} | |
} | |
function scopeTest () { | |
var scope = { | |
oneWay: '&', | |
twoWay: '=' | |
} | |
function link (scope) { | |
scope.oneWay('BOB') | |
scope.oneWay({name: 'BOB'}) | |
scope.twoWay('JAMES') | |
} | |
return { | |
scope: scope, | |
restrict: 'A', | |
link: link | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment