mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-13 08:56:40 +08:00
fix undefine style
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user