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]
In recent years, artificial intelligence (AI) has evolved to include more sophisticated and capable agents,…
Adaptive learning helps in tailoring learning experiences to fit the unique needs of each student.…
With the increasing demand for more powerful machine learning (ML) systems that can handle diverse…
Anxiety is a common mental health condition that affects millions of people around the world.…
In machine learning, confounder features or variables can significantly affect the accuracy and validity of…
Last updated: 26 Sept, 2024 Credit card fraud detection is a major concern for credit…