var app = angular.module("app",[]); app.controller("LocationCtrl", function($scope){ $scope.location = { lon: "61.61", lat: "41.41" } }); app.directive('location', function () { return { restrict: "E", scope: {}, template: 'Lon: {{location.lon}} Lat: {{location.lat}}' }; });
<div ng-app="app"> <div ng-controller="LocationCtrl"> <location></location> </div> </div>