I need something like this, but it doesn’t work
.directive('dateTime', function(){
return {
restrict: 'E',
replace: true,
scope:'=value',
template: "<div>{{value.format('mmm dd yy')}}"</div>",
// ^here: applying a function to the scope
};
});
You’ve created an isolate scope with
scope: '=value'so this is a brand new scope that does not prototypically inherit from the parent scope. This means that any functions you want to call must be fromrequireto get access (see thetabsandpanedirectives on the Angular home page for an example)