Skip to content

Commit d23d559

Browse files
committed
Added ng:options directive
Closes angular#301
1 parent 30fdade commit d23d559

File tree

11 files changed

+533
-159
lines changed

11 files changed

+533
-159
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
<a name="0.9.17"><a/>
22
# <angular/> 0.9.17 vegetable-reanimation (in progress) #
33

4+
### New Features
5+
- Added ng:options directive (http://docs.angularjs.org/#!angular.directive.ng:options)
6+
7+
48
### Bug Fixes
59
- Number filter would return incorrect value when fractional part had leading zeros.
610

11+
712
### Breaking changes
813
- $service now has $service.invoke for method injection ($service(self, fn) no longer works)
914
- injection name inference no longer supports method curry and linking functions. Both must be
1015
explicitly specified using $inject property.
16+
- Dynamic Iteration (ng:repeater) on <option> elements is no longer supported. Use ng:options
17+
1118

1219

1320
<a name="0.9.16"><a/>

src/Angular.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ if ('i' !== 'I'.toLowerCase()) {
5252
function fromCharCode(code) { return String.fromCharCode(code); }
5353

5454

55-
var $$element = '$element',
56-
$$update = '$update',
55+
var _undefined = undefined,
56+
_null = null,
57+
$$element = '$element',
5758
$$scope = '$scope',
5859
$$validate = '$validate',
5960
$angular = 'angular',

src/directives.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,8 @@ var REMOVE_ATTRIBUTES = {
443443
angularDirective("ng:bind-attr", function(expression){
444444
return function(element){
445445
var lastValue = {};
446-
var updateFn = element.data($$update) || noop;
447446
this.$onEval(function(){
448-
var values = this.$eval(expression),
449-
dirty = noop;
447+
var values = this.$eval(expression);
450448
for(var key in values) {
451449
var value = compileBindTemplate(values[key]).call(this, element),
452450
specialName = REMOVE_ATTRIBUTES[lowercase(key)];
@@ -464,10 +462,8 @@ angularDirective("ng:bind-attr", function(expression){
464462
} else {
465463
element.attr(key, value);
466464
}
467-
dirty = updateFn;
468465
}
469466
}
470-
dirty();
471467
}, element);
472468
};
473469
});

src/formatters.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ angularFormatter.trim = formatter(
204204
* @workInProgress
205205
* @ngdoc formatter
206206
* @name angular.formatter.index
207+
* @deprecated
207208
* @description
208209
* Index formatter is meant to be used with `select` input widget. It is useful when one needs
209210
* to select from a set of objects. To create pull-down one can iterate over the array of object
@@ -250,6 +251,7 @@ angularFormatter.trim = formatter(
250251
</doc:scenario>
251252
</doc:example>
252253
*/
254+
//TODO: delete me since this is replaced by ng:options
253255
angularFormatter.index = formatter(
254256
function(object, array){
255257
return '' + indexOf(array || [], object);

src/jqLite.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,20 @@ forEach({
408408
});
409409
},
410410

411+
prepend: function(element, node) {
412+
if (element.nodeType === 1) {
413+
var index = element.firstChild;
414+
forEach(new JQLite(node), function(child){
415+
if (index) {
416+
element.insertBefore(child, index);
417+
} else {
418+
element.appendChild(child);
419+
index = child;
420+
}
421+
});
422+
}
423+
},
424+
411425
remove: function(element) {
412426
JQLiteDealoc(element);
413427
var parent = element.parentNode;

src/parser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ function parser(text, json){
239239
pipeFunction =
240240
function (){ throwError("is not valid json", {text:text, index:0}); };
241241
}
242+
//TODO: Shouldn't all of the public methods have assertAllConsumed?
243+
//TODO: I think these should be public as part of the parser api instead of scope.$eval().
242244
return {
243245
assignable: assertConsumed(assignable),
244246
primary: assertConsumed(primary),
@@ -659,4 +661,3 @@ function parser(text, json){
659661

660662

661663

662-

0 commit comments

Comments
 (0)