Created
March 18, 2015 00:31
-
-
Save kalbarczyk/06f4f2bf85421469a8e4 to your computer and use it in GitHub Desktop.
AngularJS - Zrozumieć require
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 data-ng-app="app"> | |
<head> | |
<title>AngularJS - Zrozumieć require</title> | |
</head> | |
<body> | |
<div> | |
<input type="text" ng-model="text" placeholder="Wpisz text" /> | |
<div wjs-require ng-model="text"></div> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script> | |
<script> | |
(function () { | |
'use strict'; | |
angular | |
.module('app', []); | |
})(); | |
(function () { | |
'use strict'; | |
angular.module('app') | |
.directive('wjsRequire', wjsRequire); | |
function wjsRequire() { | |
return { | |
restrict: 'A', | |
require: '^ngModel', | |
template: '<div><h4>Text: {{ngModel}}</h4></div>', | |
scope: { | |
ngModel: '=' | |
}, | |
} | |
} | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment