Skip to content

Commit

Permalink
Wagon: Deploying sitegen to repository
Browse files Browse the repository at this point in the history
  • Loading branch information
FuseSource CI committed Apr 9, 2013
1 parent 5d4620d commit ec34cbb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions developers/index.html
Expand Up @@ -202,6 +202,30 @@ <h4 id = "Handy_AngularJS_debugging_tip">Handy AngularJS debugging tip</h4>

<p>You have now defined a variable called <em>s</em> which contains all the values in the active AngularJS scope so you can navigate into the scope and inspect values or invoke functions in the REPL, etc.</p>

<h3 id = "Handy_AngularJS_programming_tips">Handy AngularJS programming tips</h3>

<h4 id = "Use_a_nested_scope_object_to_own_state_for_2_way_binding">Use a nested scope object to own state for 2 way binding</h4>

<p>When binding models to HTML templates; its always a good idea to use a level of indirection between the $scope and the property. So rather than binding to $scope.name, bind to $scope.entity.name then have code like</p>

<pre><code>$scope.entity = { &quot;name&quot;: &quot;James&quot; };</code></pre>

<p>This means to that to reset the form you can just do</p>

<pre><code>$scope.entity = {};</code></pre>

<p>And you can then refer to the entire entity via <strong>$scope.entity</strong>. Another reason for doing this is that when you have lots of nested scopes; for example when using nested directives, or using includes or layouts, you don't get inheritence issues; since you can acess $scope.entity from child scopes fine.</p>

<h4 id = "When_working_with__routeParams_use_the__scope__on">When working with $routeParams use the $scope.$on</h4>

<p>Its often useful to use $routeParams to get the URI template parameters. However due to <a href="http://deansofer.com/posts/view/14/AngularJs-Tips-and-Tricks-UPDATED#routing">the rules on who gets the $routeParams injected</a> when using layouts and so forth, the $routeParams can be empty.</p>

<p>So put all code that uses $routeParams inside the $routeChangeSuccess callback:</p>

<pre><code>$scope.$on('$routeChangeSuccess', function(event, routeData){
// process $routeParams now...
});</code></pre>

<h3 id = "Local_Storage">Local Storage</h3>

<p>hawtio uses local storage to store preferences and preferred views for different kinds of MBean type and so forth.</p>
Expand Down

0 comments on commit ec34cbb

Please sign in to comment.