Skip to content

Instantly share code, notes, and snippets.

Created August 12, 2015 01:27
Show Gist options
  • Save anonymous/839b864e4e0b70281153 to your computer and use it in GitHub Desktop.
Save anonymous/839b864e4e0b70281153 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/zomamupose
<!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>
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