The directive discussed in the blog is following:
<hello name="Calvin Hobbes"></hello>
Following are some of the key aspects:
Following are key aspects of working with the code given below:
angular.module('HelloModule', [])
.directive( 'hello', function() {
return {
restrict: "E",
scope:{
name: '@'
},
templateUrl: 'templates/hello.html'
}
})
<div>
<input type="text" ng-model="name" value="{{name}}"/>
</div>
<div>
<h3>Hello {{ name }}!</h3>
</div>
<!DOCTYPE html>
<html ng-app="HelloApp">
<head>
<title>AngularJS - Custom Directive Hello World - Code Example</title>
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body ng-controller="HelloCtrl" class="container">
<div class="page-header"><h2>AngularJS - Custom Directive Hello World - Code Example</h2></div>
<hello name="Calvin Hobbes"></hello>
<bye></bye>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript">
angular.module('HelloApp', ['HelloModule'])
.controller('HelloCtrl', ['$scope', function($scope){
}])
</script>
</body>
</html>
…
[adsenseyu1]
Last updated: 3rd May, 2024 Have you ever wondered why some machine learning models perform…
Last updated: 2nd May, 2024 The success of machine learning models often depends on the…
When working on a machine learning project, one of the key challenges faced by data…
Last updated: 1st May, 2024 The bias-variance trade-off is a fundamental concept in machine learning…
Last updated: 1st May, 2024 As a data scientist, understanding the nuances of various cost…
Last updated: 1st May, 2024 In this post, you will learn the concepts related to…