Monday, January 13, 2014

HTML markup for AngularJS views

I am working my way through "AngularJS Starter" which is a 51 page book by Dan Menard. Some of the syntax examples in his first example of a view include:

  1. Here is a typical ng-repeat loop with a filter which refines how the results are ordered.
    <li ng-repeat='note in chapter.notes | orderBy"id"'>
     
  2. This could be done inside the loop:
    <p>{{note.content}}</p>
     
  3. This could be a link inside the loop:
    <a href ng-click='onDelete(note.id)'>delete</a>
     
  4. A link to another route:
    <a href='#/addNote/{{chapter.id}}'>add note</a>
     
  5. Showing or hiding copy conditionally:
    <span ng-show='chapter.notes.length == 1'>note</span>
    <span ng-hide='chapter.notes.length == 1'>notes</span>

No comments:

Post a Comment