File Name: directive-test2-5.js
var tes = angular.module("myApp", []);
tes.controller("AppCtrl", function () {
var app = this;
app.message = "Hello";
})
tes.directive("supermanTag", function ($window) {
return {
restrict: "A",
link: function () {
$window.alert("First Attribute supermanTag");
}
}
})
tes.directive("flash", function ($window) {
return {
restrict: "A",
link: function () {
$window.alert("Second Attribute flash");
}
}
})
File Name: Session2-5.html
<html>
<head>
<title>Directive</title>
</head>
<body>
<div ng-app="myApp" ng-controller="AppCtrl as app">
<div superman-tag flash></div>
</div>
<script src="../node_modules/angular/angular.min.js"></script>
<script src="directive-test2-5.js"></script>
</body>
</html>
Comments
Post a Comment