I have created a simple directive but at the moment i don't have any scope set. However i want the directive to use isolated scope so that i can easily reuse it.
This is my html and the directive is called "select-time":
<div class="menuHour after" select-time><div class="menuHour-panel before"><span class="menuHour-panel-title" ng-click="changeToBefore()">Before 12h</span></div> I have kept the example short so the only thing it's doing here is changing the class "menuHour after" to "menuHour before".
It's doing that with a method "changeToBefore()".
This is my directive:
angular.module("tiki").directive("selectTime", function(newTiki){ return { restrict:"A", controller:function($scope, $element, $attrs){ $scope.changeToBefore = function(){ var menuHour = document.querySelector(".menuHour") menuHour.classList.remove("after") menuHour.classList.add("before") } } } })
How can i change this to an isolated scope directive?
Thx,