Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>To your first question</strong>: Instead of loading the data in <code>LibraryCtrl</code> and using it in <code>DashboardCtrl</code>, create a service. Load the model via the service and have both controllers use it.</p> <p><a href="http://docs.angularjs.org/api/ngResource" rel="nofollow">http://docs.angularjs.org/api/ngResource</a>.$resource</p> <p>If you haven't looked at <a href="https://github.com/angular/angular-seed" rel="nofollow">angular-seed</a>, take a peek at it. It gives a good skeleton for this sort of thing.</p> <p><strong>To your second question</strong>: This is an ideal place for directives. (The answer to a vast number of Angular questions is 'make a directive', and that's doubly so if you're making reusable widgets). In fact, I'd do a directive for the dashboard as a whole, and another for 'dashboard-item'. Rather than specifying the template directly in the directive declaration, use templateUrl...which can use the result of an expression. Point it at different template files depending on the type.</p> <p>Alternatively, create one template file and use <code>ng-switch</code> based on type to determine which section of it to display.</p> <p>For info on creating directives, look at the tutorial and also look <a href="http://docs.angularjs.org/guide/directive" rel="nofollow">here</a>.</p> <p>Skip down to "Writing directives (long version)". Don't read the compilation and linking stuff yet; go back to it if you need it. The order in which stuff is presented on that page is unfortunate.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload