mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-18 11:31:07 +00:00
merge
This commit is contained in:
commit
2a3a449c6d
3 changed files with 28 additions and 12 deletions
21
src/JSON.js
21
src/JSON.js
|
|
@ -77,19 +77,16 @@ function toJsonArray(buf, obj, pretty, stack){
|
||||||
keys.sort();
|
keys.sort();
|
||||||
for ( var keyIndex = 0; keyIndex < keys.length; keyIndex++) {
|
for ( var keyIndex = 0; keyIndex < keys.length; keyIndex++) {
|
||||||
var key = keys[keyIndex];
|
var key = keys[keyIndex];
|
||||||
try {
|
var value = obj[key];
|
||||||
var value = obj[key];
|
if (typeof value != $function) {
|
||||||
if (typeof value != $function) {
|
if (comma) {
|
||||||
if (comma) {
|
buf.push(",");
|
||||||
buf.push(",");
|
if (pretty) buf.push(pretty);
|
||||||
if (pretty) buf.push(pretty);
|
|
||||||
}
|
|
||||||
buf.push(angular['String']['quote'](key));
|
|
||||||
buf.push(":");
|
|
||||||
toJsonArray(buf, value, childPretty, stack);
|
|
||||||
comma = true;
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
buf.push(angular['String']['quote'](key));
|
||||||
|
buf.push(":");
|
||||||
|
toJsonArray(buf, value, childPretty, stack);
|
||||||
|
comma = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf.push("}");
|
buf.push("}");
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,8 @@ angularWidget('ng:include', function(element){
|
||||||
compiler.compile(element)(element, childScope);
|
compiler.compile(element)(element, childScope);
|
||||||
childScope.$init();
|
childScope.$init();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
element.html('');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -454,6 +454,23 @@ describe("widget", function(){
|
||||||
scope.$init();
|
scope.$init();
|
||||||
expect(element.text()).toEqual('misko');
|
expect(element.text()).toEqual('misko');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should remove previously included text if a falsy value is bound to src', function() {
|
||||||
|
var element = jqLite('<ng:include src="url" scope="childScope"></ng:include>');
|
||||||
|
var scope = angular.compile(element);
|
||||||
|
scope.childScope = createScope();
|
||||||
|
scope.childScope.name = 'igor';
|
||||||
|
scope.url = 'myUrl';
|
||||||
|
scope.$xhr.cache.data.myUrl = {value:'{{name}}'};
|
||||||
|
scope.$init();
|
||||||
|
|
||||||
|
expect(element.text()).toEqual('igor');
|
||||||
|
|
||||||
|
scope.url = undefined;
|
||||||
|
scope.$eval();
|
||||||
|
|
||||||
|
expect(element.text()).toEqual('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue