mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-18 15:50:22 +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){
|
||||
return function(element){
|
||||
this.$onEval(function(){
|
||||
element.css(this.$eval(expression));
|
||||
element.css(this.$eval(expression) || {});
|
||||
}, element);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -174,6 +174,13 @@ describe("directives", function(){
|
|||
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(){
|
||||
var scope = compile('<div ng:hide="hide"></div>');
|
||||
scope.$eval();
|
||||
|
|
|
|||
Loading…
Reference in a new issue