closes #1818 Previously, the markdown of some chapters was converted to Jade markup to support the conditional exclusion of TS prose parts in Dart chapters. This commit reverts some of that back to clean markdown, thanks to a few custom directives.
25 lines
687 B
JavaScript
25 lines
687 B
JavaScript
/*
|
|
* 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) {
|
|
var ngIfCond = (attrs.ifDocs === 'dart') == !NgIoUtil.isDartDoc($location);
|
|
attrs.ngIf = function () { return !ngIfCond; }
|
|
ngIf.link.apply(ngIf, arguments);
|
|
}
|
|
};
|
|
}]); |