From e0ee3a0726f43972244e400863a6dcf567f00a0e Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Tue, 7 Jun 2011 23:13:44 +0200 Subject: Update latest docs content from gdocs --- docs/content/cookbook/mvc.ngdoc | 93 +++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 46 deletions(-) (limited to 'docs/content/cookbook/mvc.ngdoc') diff --git a/docs/content/cookbook/mvc.ngdoc b/docs/content/cookbook/mvc.ngdoc index bc0eb653..04feffcc 100644 --- a/docs/content/cookbook/mvc.ngdoc +++ b/docs/content/cookbook/mvc.ngdoc @@ -17,7 +17,7 @@ no connection between the controller and the view. - + + +

Tic-Tac-Toe

Next Player: {{nextMove}}
Player {{winner}} has won!
- - - - -
{{cell}}
- + + + + +
{{cell}}
+
-
- - it('should play a game', function(){ - piece(1, 1); - expect(binding('nextMove')).toEqual('O'); - piece(3, 1); - expect(binding('nextMove')).toEqual('X'); - piece(1, 2); - piece(3, 2); - piece(1, 3); - expect(element('.winner').text()).toEqual('Player X has won!'); - }); - - - function piece(row, col) { - element('.board tr:nth-child('+row+') td:nth-child('+col+')').click(); - } - +
+ + it('should play a game', function(){ + piece(1, 1); + expect(binding('nextMove')).toEqual('O'); + piece(3, 1); + expect(binding('nextMove')).toEqual('X'); + piece(1, 2); + piece(3, 2); + piece(1, 3); + expect(element('.winner').text()).toEqual('Player X has won!'); + }); + + + function piece(row, col) { + element('.board tr:nth-child('+row+') td:nth-child('+col+')').click(); + } +
@@ -123,13 +125,12 @@ no connection between the controller and the view. * The controller is defined in JavaScript and has no reference to the rendering logic. * The controller is instantiated by and injected into the view. * The controller can be instantiated in isolation (without a view) and the code will still execute. - This makes it very testable. +This makes it very testable. * The HTML view is a projection of the model. In the above example, the model is stored in the - board variable. +board variable. * All of the controller's properties (such as board and nextMove) are available to the view. * Changing the model changes the view. * The view can call any controller function. * In this example, the `setUrl()` and `readUrl()` functions copy the game state to/from the URL's - hash so the browser's back button will undo game steps. See deep-linking. This example calls - {@link api/angular.scope.$watch $watch()} to set up a listener that invokes `readUrl()` when -needed. +hash so the browser's back button will undo game steps. See deep-linking. This example calls {@link +api/angular.scope.$watch $watch()} to set up a listener that invokes `readUrl()` when needed. -- cgit v1.2.3