Created
January 13, 2015 22:30
-
-
Save mreis1/eb7e8fb8b9eaf39ac6b3 to your computer and use it in GitHub Desktop.
This is a template for angular experiments // source http://jsbin.com/feciqatari
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> | |
<meta name="description" content="This is a template for angular experiments" /> | |
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js"></script> | |
</head> | |
<script src="http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js"></script> | |
<body> | |
<div ng-controller="foo"> | |
{{binValue.getByte();}} | |
<input type="text" ng-model="value"> | |
<a href="#" ng-click="setBin()">update</a> | |
</div> | |
<div ng-controller="bar"> | |
{{binValue.getByte();}} | |
<input type="text" ng-model="binValue.byte"> | |
<a href="#" ng-click="setBin()">update</a> | |
</div> | |
<script id="jsbin-javascript"> | |
angular.module('myApp',[]) | |
.controller('foo', function(binFactory,$scope){ | |
$scope.binValue = binFactory; | |
$scope.setBin = setBin; | |
$scope.value = 'foo'; | |
function setBin(){ | |
binFactory.setByte($scope.value) | |
} | |
}) | |
.controller('bar', function(binFactory,$scope){ | |
$scope.binValue = binFactory; | |
$scope.setBin = setBin; | |
function setBin(){ | |
binFactory.setByte($scope.value) | |
} | |
}) | |
.factory('binFactory',function(){ | |
var byte = 'dog'; | |
var service = { | |
byte: byte, | |
getByte: getByte, | |
setByte: setByte | |
} | |
return service; | |
function getByte(){ | |
return this.byte; | |
} | |
function setByte(value){ | |
this.byte = value; | |
} | |
}) | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">angular.module('myApp',[]) | |
.controller('foo', function(binFactory,$scope){ | |
$scope.binValue = binFactory; | |
$scope.setBin = setBin; | |
$scope.value = 'foo'; | |
function setBin(){ | |
binFactory.setByte($scope.value) | |
} | |
}) | |
.controller('bar', function(binFactory,$scope){ | |
$scope.binValue = binFactory; | |
$scope.setBin = setBin; | |
function setBin(){ | |
binFactory.setByte($scope.value) | |
} | |
}) | |
.factory('binFactory',function(){ | |
var byte = 'dog'; | |
var service = { | |
byte: byte, | |
getByte: getByte, | |
setByte: setByte | |
} | |
return service; | |
function getByte(){ | |
return this.byte; | |
} | |
function setByte(value){ | |
this.byte = value; | |
} | |
})</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
angular.module('myApp',[]) | |
.controller('foo', function(binFactory,$scope){ | |
$scope.binValue = binFactory; | |
$scope.setBin = setBin; | |
$scope.value = 'foo'; | |
function setBin(){ | |
binFactory.setByte($scope.value) | |
} | |
}) | |
.controller('bar', function(binFactory,$scope){ | |
$scope.binValue = binFactory; | |
$scope.setBin = setBin; | |
function setBin(){ | |
binFactory.setByte($scope.value) | |
} | |
}) | |
.factory('binFactory',function(){ | |
var byte = 'dog'; | |
var service = { | |
byte: byte, | |
getByte: getByte, | |
setByte: setByte | |
} | |
return service; | |
function getByte(){ | |
return this.byte; | |
} | |
function setByte(value){ | |
this.byte = value; | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment