AngularJS scope with attr expression
by dekkard
HTML
<div ng-app="helloHabrahabr">
<div ng-controller="forExampleController">
a={{a}}
<br>
b={{b}}
<br>
parent's hello={{hello}}
<br>
<br>
<span habra-habr some-attr="hello= a+b"></span>
</div>
</div>
JavaScript
function forExampleController($scope){
$scope.a="Hello";
$scope.b=" Habr!";
}
angular.module('helloHabrahabr', [])
.directive('habraHabr', function() {
return {
template:"default helloFn={{helloFn()}}\
<br>\
custom hello={{helloFn({a:'Bye',b:'Habr'})}}",
scope:{
helloFn:'&someAttr'
}
}
});