aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVojta Jina2012-03-23 15:48:51 -0700
committerVojta Jina2012-03-26 21:14:09 -0700
commit55027132f3d57e5dcf94683e6e6bd7b0aae0087d (patch)
tree489b72f4fd22db897caddbe5288f99b57e529753 /src
parent09e175f02cca0f4a295fd0c9b980cd8f432e722b (diff)
downloadangular.js-55027132f3d57e5dcf94683e6e6bd7b0aae0087d.tar.bz2
refactor(ngBindAttr): remove
Breaks ng-bind-attr directive removed
Diffstat (limited to 'src')
-rw-r--r--src/AngularPublic.js1
-rw-r--r--src/directive/ngBind.js95
2 files changed, 0 insertions, 96 deletions
diff --git a/src/AngularPublic.js b/src/AngularPublic.js
index 65ebe3f0..9a0e1977 100644
--- a/src/AngularPublic.js
+++ b/src/AngularPublic.js
@@ -74,7 +74,6 @@ function publishExternalAPI(angular){
ngBindHtml: ngBindHtmlDirective,
ngBindHtmlUnsafe: ngBindHtmlUnsafeDirective,
ngBindTemplate: ngBindTemplateDirective,
- ngBindAttr: ngBindAttrDirective,
ngClass: ngClassDirective,
ngClassEven: ngClassEvenDirective,
ngClassOdd: ngClassOddDirective,
diff --git a/src/directive/ngBind.js b/src/directive/ngBind.js
index 23588de5..32be2f4b 100644
--- a/src/directive/ngBind.js
+++ b/src/directive/ngBind.js
@@ -153,98 +153,3 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
});
}
}];
-
-
-/**
- * @ngdoc directive
- * @name angular.module.ng.$compileProvider.directive.ng-bind-attr
- * @restrict A
- *
- * @description
- * The `ng-bind-attr` attribute specifies that a
- * {@link guide/dev_guide.templates.databinding databinding} should be created between a particular
- * element attribute and a given expression. Unlike `ng-bind`, the `ng-bind-attr` contains one or
- * more JSON key value pairs; each pair specifies an attribute and the
- * {@link guide/dev_guide.expressions expression} to which it will be mapped.
- *
- * Instead of writing `ng-bind-attr` statements in your HTML, you can use double-curly markup to
- * specify an <tt ng-non-bindable>{{expression}}</tt> for the value of an attribute.
- * At compile time, the attribute is translated into an
- * `<span ng-bind-attr="{attr:expression}"></span>`.
- *
- * The following HTML snippet shows how to specify `ng-bind-attr`:
- * <pre>
- * <a ng-bind-attr='{"href":"http://www.google.com/search?q={{query}}"}'>Google</a>
- * </pre>
- *
- * This is cumbersome, so as we mentioned using double-curly markup is a prefered way of creating
- * this binding:
- * <pre>
- * <a href="http://www.google.com/search?q={{query}}">Google</a>
- * </pre>
- *
- * During compilation, the template with attribute markup gets translated to the ng-bind-attr form
- * mentioned above.
- *
- * _Note_: You might want to consider using {@link angular.module.ng.$compileProvider.directive.ng-href ng-href} instead of
- * `href` if the binding is present in the main application template (`index.html`) and you want to
- * make sure that a user is not capable of clicking on raw/uncompiled link.
- *
- *
- * @element ANY
- * @param {string} ng-bind-attr one or more JSON key-value pairs representing
- * the attributes to replace with expressions. Each key matches an attribute
- * which needs to be replaced. Each value is a text template of
- * the attribute with the embedded
- * <tt ng-non-bindable>{{expression}}</tt>s. Any number of
- * key-value pairs can be specified.
- *
- * @example
- * Enter a search string in the Live Preview text box and then click "Google". The search executes instantly.
- <doc:example>
- <doc:source>
- <script>
- function Ctrl($scope) {
- $scope.query = 'AngularJS';
- }
- </script>
- <div ng-controller="Ctrl">
- Google for:
- <input type="text" ng-model="query" ng-model-instant>
- <a ng-bind-attr='{"href":"http://www.google.com/search?q={{query}}"}'>
- Google
- </a> (ng-bind-attr) |
- <a href="http://www.google.com/search?q={{query}}">Google</a>
- (curly binding in attribute val)
- </div>
- </doc:source>
- <doc:scenario>
- it('should check ng-bind-attr', function() {
- expect(using('.doc-example-live').element('a').attr('href')).
- toBe('http://www.google.com/search?q=AngularJS');
- using('.doc-example-live').input('query').enter('google');
- expect(using('.doc-example-live').element('a').attr('href')).
- toBe('http://www.google.com/search?q=google');
- });
- </doc:scenario>
- </doc:example>
- */
-
-var ngBindAttrDirective = ['$interpolate', function($interpolate) {
- return function(scope, element, attr) {
- var lastValue = {};
- var interpolateFns = {};
- scope.$watch(function() {
- var values = scope.$eval(attr.ngBindAttr);
- for(var key in values) {
- var exp = values[key],
- fn = (interpolateFns[exp] ||
- (interpolateFns[values[key]] = $interpolate(exp))),
- value = fn(scope);
- if (lastValue[key] !== value) {
- attr.$set(key, lastValue[key] = value);
- }
- }
- });
- }
-}];