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]
Artificial Intelligence (AI) agents have started becoming an integral part of our lives. Imagine asking…
In the ever-evolving landscape of agentic AI workflows and applications, understanding and leveraging design patterns…
In this blog, I aim to provide a comprehensive list of valuable resources for learning…
Have you ever wondered how systems determine whether to grant or deny access, and how…
What revolutionary technologies and industries will define the future of business in 2025? As we…
For data scientists and machine learning researchers, 2024 has been a landmark year in AI…