mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-25 06:13:44 +00:00
fix undefine style
This commit is contained in:
parent
32361d03a1
commit
9998b8dcbb
2 changed files with 8 additions and 1 deletions
|
|
@ -255,7 +255,7 @@ angularDirective("ng:hide", function(expression, element){
|
||||||
angularDirective("ng:style", function(expression, element){
|
angularDirective("ng:style", function(expression, element){
|
||||||
return function(element){
|
return function(element){
|
||||||
this.$onEval(function(){
|
this.$onEval(function(){
|
||||||
element.css(this.$eval(expression));
|
element.css(this.$eval(expression) || {});
|
||||||
}, element);
|
}, element);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,13 @@ describe("directives", function(){
|
||||||
expect(element.css('color')).toEqual('red');
|
expect(element.css('color')).toEqual('red');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should silently ignore undefined ng:style', function() {
|
||||||
|
var scope = compile('<div ng:style="myStyle"></div>');
|
||||||
|
scope.$eval();
|
||||||
|
dump(sortedHtml(element));
|
||||||
|
expect(element.hasClass('ng-exception')).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
it('should ng:show', function(){
|
it('should ng:show', function(){
|
||||||
var scope = compile('<div ng:hide="hide"></div>');
|
var scope = compile('<div ng:hide="hide"></div>');
|
||||||
scope.$eval();
|
scope.$eval();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue