Create a directive using template and restrict Element
File Name: directive-test2-3.js
var tes = angular.module("myApp", []);
tes.controller("AppCtrl", function () {
var app = this;
app.message = "Hello";
})
tes.directive("superman", function () {
return {
restrict: "E",
template: "<div>Here i am save the day</div>"
}
File Name: Session2-3.html
<html>
<head>
<title>Directive</title>
</head>
<body>
<div ng-app="myApp" ng-controller="AppCtrl as app">
<superman></superman>
</div>
<script src="../node_modules/angular/angular.min.js"></script>
<script src="directive-test2-3.js"></script>
</body>
</html>
Comments
Post a Comment