AngularJs Directives For Beginners
At a high level, directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS's HTML compiler ($compile) to attach a specified behavior to that DOM element or even transform the DOM element and its children.
HTML Markup
<body ng-app="MyAbcApp">
<div ng-controller="Controller">
<div my-customer></div>
</div>
</body>
Angular Js
angular.module('MyAbcApp', [])
.controller('Controller', ['$scope', function($scope) {
$scope.customer = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
}])
.directive('myCustomer', function() {
return {
template:
'Name: {{customer.name}} Address: {{customer.address}}'
};
});
You can also check this site called careerbaba for all the latest interview questions and interview experiences
Written by Yasser Shaikh
Related protips
1 Response
How is the last link related to anything?
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Angularjs
Authors
Related Tags
#angularjs
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#