var app = angular.module("app",[]); app.controller("ColorController", function($scope){ $scope.hex = "#112233"; }) app.directive("color", function() { return { restrict: 'E', scope: { hex: '=' }, template: '<input type="text" ng-model="hex"/> {{hex}}' } });
<div ng-app="app"> <div ng-controller="ColorController"> Renk-1 <color hex="hex"></color><br/> </div> </div>