added ng-controller directive

This commit is contained in:
Misko Hevery
2010-04-05 21:26:52 -07:00
parent 2107eafcde
commit e646068586
4 changed files with 40 additions and 3 deletions

View File

@@ -156,4 +156,19 @@ describe("directives", function(){
scope.$eval();
expect(element.css('display')).toEqual('');
});
it('should ng-controller', function(){
window.Greeter = function(){
this.greeting = 'hello';
};
window.Greeter.prototype = {
greet: function(name) {
return this.greeting + ' ' + name;
}
};
var scope = compile('<div ng-controller="Greeter"></div>');
expect(scope.greeting).toEqual('hello');
expect(scope.greet('misko')).toEqual('hello misko');
delete window.Greeter;
});
});