diff options
Diffstat (limited to 'docs/content/cookbook/deeplinking.ngdoc')
| -rw-r--r-- | docs/content/cookbook/deeplinking.ngdoc | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/docs/content/cookbook/deeplinking.ngdoc b/docs/content/cookbook/deeplinking.ngdoc index 6cc0b356..e49287bb 100644 --- a/docs/content/cookbook/deeplinking.ngdoc +++ b/docs/content/cookbook/deeplinking.ngdoc @@ -3,18 +3,14 @@ @name Cookbook: Deep Linking @description - Deep linking allows you to encode the state of the application in the URL so that it can be bookmarked and the application can be restored from the URL to the same state. - While <angular/> does not force you to deal with bookmarks in any particular way, it has services which make the common case described here very easy to implement. - # Assumptions - Your application consists of a single HTML page which bootstraps the application. We will refer to this page as the chrome. Your application is divided into several screens (or views) which the user can visit. For example, @@ -25,30 +21,22 @@ screen will be constructed from an HTML snippet, which we will refer to as the p have multiple partials, but a single partial is the most common construct. This example makes the partial boundary visible using a blue line. - You can make a routing table which shows which URL maps to which partial view template and which controller. - # Example - In this example we have a simple app which consist of two screens: - * Welcome: url `#` Show the user contact information. * Settings: url `#/settings` Show an edit screen for user contact information. - - The two partials are defined in the following URLs: - * {@link ./examples/settings.html} * {@link ./examples/welcome.html} - <doc:example> <doc:source> <script> @@ -59,7 +47,6 @@ The two partials are defined in the following URLs: $route.when("/settings", {template:'./examples/settings.html', controller:SettingsCntl}); $route.parent(this); - // initialize the model to something useful this.person = { name:'anonymous', @@ -67,7 +54,6 @@ The two partials are defined in the following URLs: }; } - function WelcomeCntl($route){} WelcomeCntl.prototype = { greet: function(){ @@ -75,7 +61,6 @@ The two partials are defined in the following URLs: } }; - function SettingsCntl(){ this.cancel(); } @@ -84,7 +69,6 @@ The two partials are defined in the following URLs: this.form = angular.copy(this.person); }, - save: function(){ angular.copy(this.form, this.person); window.location.hash = "#"; @@ -117,12 +101,8 @@ The two partials are defined in the following URLs: - - - # Things to notice - * Routes are defined in the `AppCntl` class. The initialization of the controller causes the initialization of the {@link api/angular.service.$route $route} service with the proper URL routes. |
