Skip to content

Instantly share code, notes, and snippets.

@kalbarczyk
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kalbarczyk/e6dd20d587a985d0e3e3 to your computer and use it in GitHub Desktop.
Save kalbarczyk/e6dd20d587a985d0e3e3 to your computer and use it in GitHub Desktop.
AngularJS - Zrozumieć ng-transclude
<!doctype html>
<html data-ng-app="app">
<head>
<title>AngularJS - Zrozumieć ng-transclude</title>
</head>
<body>
<div>
<wjs-transclude name="AngularJS">Zrozumieć ng-transclude</wjs-transclude>
</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('wjsTransclude', wjsTransclude);
function wjsTransclude() {
return {
restrict: 'E',
transclude: true,
scope: { name:'@' },
template: '<div>' +
'<div>{{name}}</div><br>' +
'<div ng-transclude></div>' +
'</div>'
};
}
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment