2016-07-03 20:11:17 -04:00
|
|
|
/*
|
|
|
|
* Angular.io Example Conditional Directive
|
|
|
|
*
|
|
|
|
* Usage:
|
|
|
|
* <tag if-docs="ts|dart">...</tag>
|
|
|
|
*
|
|
|
|
* This is equivalent to an ngIf that holds if this containing
|
|
|
|
* docs are for TypeScript.
|
|
|
|
*/
|
|
|
|
|
|
|
|
angularIO.directive('ifDocs', ['ngIfDirective', '$location', function (ngIfDirective, $location) {
|
|
|
|
var ngIf = ngIfDirective[0];
|
|
|
|
|
|
|
|
return {
|
|
|
|
transclude: ngIf.transclude,
|
|
|
|
priority: ngIf.priority,
|
|
|
|
terminal: ngIf.terminal,
|
|
|
|
restrict: ngIf.restrict,
|
|
|
|
link: function (scope, element, attrs) {
|
2016-07-30 22:00:52 -04:00
|
|
|
var ngIfCond = (attrs.ifDocs === 'dart') == !NgIoUtil.isDoc($location, 'dart');
|
2016-07-03 20:11:17 -04:00
|
|
|
attrs.ngIf = function () { return !ngIfCond; }
|
|
|
|
ngIf.link.apply(ngIf, arguments);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}]);
|