Simple directive

by Uday Hiwarale

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
	<car tires="tires"></car>
</div>

JavaScript

angular
	.module('myApp', [])
	.controller('myCtrl', function($scope){
		$scope.tires = 2;
	})
	.directive('car', function(){
		return {
			restrict : 'AE',
			scope : {
				tiresCount : '=tires'
			},
			template : '<b>I am car with {{tiresCount}} tires.</b>'
		}
	});