JSFiddle - React, Tailwind, and code Playground
HTML
<body ng-app="myapp">
<span ng-controller="ctrl" ng-show="toshow()">
<a href="/" localize="'continent_'+breadcrumb+'_heading'">this won't be visible due to toshow() returning false</a>
</span>
</body>
JavaScript
angular.module('myapp', [], null).directive('localize', function() {
return {
priority: -1000, // doesn't help
link: function postLink(scope, element, attrs, controller) {
// this code is called first, before ng-show
var locKey = scope.$eval(attrs['localize']);
console.log('localization: ', locKey);
// ...
}
};
});
function ctrl($scope, $timeout) {
$scope.toshow = function() {
// caled after the localize ~ link method
console.log('evaluating ng-show');
return false;
};
$scope.breadcrumb = 'breadcrumb part';
console.log('set variable');
}