chore: update files to match clang-format 1.0.21.
This commit is contained in:
@ -24,61 +24,66 @@ function loadTemplate(templateId, repeatCount) {
|
||||
}
|
||||
|
||||
angular.module('app', [])
|
||||
.directive('dir0', [
|
||||
'$parse',
|
||||
function($parse) {
|
||||
return {
|
||||
compile: function($element, $attrs) {
|
||||
var expr = $parse($attrs.attr0);
|
||||
return function($scope) { $scope.$watch(expr, angular.noop); }
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.directive('dir1', [
|
||||
'$parse',
|
||||
function($parse) {
|
||||
return {
|
||||
compile: function($element, $attrs) {
|
||||
var expr = $parse($attrs.attr1);
|
||||
return function($scope) { $scope.$watch(expr, angular.noop); }
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.directive('dir2', [
|
||||
'$parse',
|
||||
function($parse) {
|
||||
return {
|
||||
compile: function($element, $attrs) {
|
||||
var expr = $parse($attrs.attr2);
|
||||
return function($scope) { $scope.$watch(expr, angular.noop); }
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.directive('dir3', [
|
||||
'$parse',
|
||||
function($parse) {
|
||||
return {
|
||||
compile: function($element, $attrs) {
|
||||
var expr = $parse($attrs.attr3);
|
||||
return function($scope) { $scope.$watch(expr, angular.noop); }
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.directive('dir4', [
|
||||
'$parse',
|
||||
function($parse) {
|
||||
return {
|
||||
compile: function($element, $attrs) {
|
||||
var expr = $parse($attrs.attr4);
|
||||
return function($scope) { $scope.$watch(expr, angular.noop); }
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.directive('dir0',
|
||||
[
|
||||
'$parse',
|
||||
function($parse) {
|
||||
return {
|
||||
compile: function($element, $attrs) {
|
||||
var expr = $parse($attrs.attr0);
|
||||
return function($scope) { $scope.$watch(expr, angular.noop); }
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.directive('dir1',
|
||||
[
|
||||
'$parse',
|
||||
function($parse) {
|
||||
return {
|
||||
compile: function($element, $attrs) {
|
||||
var expr = $parse($attrs.attr1);
|
||||
return function($scope) { $scope.$watch(expr, angular.noop); }
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.directive('dir2',
|
||||
[
|
||||
'$parse',
|
||||
function($parse) {
|
||||
return {
|
||||
compile: function($element, $attrs) {
|
||||
var expr = $parse($attrs.attr2);
|
||||
return function($scope) { $scope.$watch(expr, angular.noop); }
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.directive('dir3',
|
||||
[
|
||||
'$parse',
|
||||
function($parse) {
|
||||
return {
|
||||
compile: function($element, $attrs) {
|
||||
var expr = $parse($attrs.attr3);
|
||||
return function($scope) { $scope.$watch(expr, angular.noop); }
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.directive('dir4',
|
||||
[
|
||||
'$parse',
|
||||
function($parse) {
|
||||
return {
|
||||
compile: function($element, $attrs) {
|
||||
var expr = $parse($attrs.attr4);
|
||||
return function($scope) { $scope.$watch(expr, angular.noop); }
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.run([
|
||||
'$compile',
|
||||
function($compile) {
|
||||
|
@ -19,41 +19,42 @@ angular.module('app', [])
|
||||
})
|
||||
// special directive for "if" as angular 1.3 does not support
|
||||
// recursive components.
|
||||
.directive('treeIf', [
|
||||
'$compile',
|
||||
'$parse',
|
||||
function($compile, $parse) {
|
||||
var transcludeFn;
|
||||
return {
|
||||
compile: function(element, attrs) {
|
||||
var expr = $parse(attrs.treeIf);
|
||||
var template = '<tree data="' + attrs.treeIf + '"></tree>';
|
||||
var transclude;
|
||||
return function($scope, $element, $attrs) {
|
||||
if (!transclude) {
|
||||
transclude = $compile(template);
|
||||
}
|
||||
var childScope;
|
||||
var childElement;
|
||||
$scope.$watch(expr, function(newValue) {
|
||||
if (childScope) {
|
||||
childScope.$destroy();
|
||||
childElement.remove();
|
||||
childScope = null;
|
||||
childElement = null;
|
||||
}
|
||||
if (newValue) {
|
||||
childScope = $scope.$new();
|
||||
childElement =
|
||||
transclude(childScope, function(clone) { $element.append(clone); });
|
||||
}
|
||||
});
|
||||
}
|
||||
.directive('treeIf',
|
||||
[
|
||||
'$compile',
|
||||
'$parse',
|
||||
function($compile, $parse) {
|
||||
var transcludeFn;
|
||||
return {
|
||||
compile: function(element, attrs) {
|
||||
var expr = $parse(attrs.treeIf);
|
||||
var template = '<tree data="' + attrs.treeIf + '"></tree>';
|
||||
var transclude;
|
||||
return function($scope, $element, $attrs) {
|
||||
if (!transclude) {
|
||||
transclude = $compile(template);
|
||||
}
|
||||
var childScope;
|
||||
var childElement;
|
||||
$scope.$watch(expr, function(newValue) {
|
||||
if (childScope) {
|
||||
childScope.$destroy();
|
||||
childElement.remove();
|
||||
childScope = null;
|
||||
childElement = null;
|
||||
}
|
||||
if (newValue) {
|
||||
childScope = $scope.$new();
|
||||
childElement = transclude(childScope,
|
||||
function(clone) { $element.append(clone); });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
])
|
||||
.config([
|
||||
'$compileProvider',
|
||||
function($compileProvider) { $compileProvider.debugInfoEnabled(false); }
|
||||
|
Reference in New Issue
Block a user