angularjs - Routing with Component-based Directives in Angular 1.3? -


i have question best way structure flow of app using angular 1.3. i'm trying incorporate 'component-based directive' approach per guys matias niemela (https://www.airpair.com/angularjs/workshops/component-based-directives-angularjs). says in video still use controllers routing rather going controller-free, use directives create reusable components have dependencies injected.

i'm bit new angular have used java mvc frameworks before controller written in java first finishes getting data needed on page displayed, before html constructed , served up. i'm wondering if i'm coming bit unstuck due asynchronous nature of javascript calls used in angular, maybe assuming things happen in order can't guaranteed to....

i want try make directives involved have rely on injected (likely via attr's) increased test-ability etc.

i had envisaged following, simple customer listing, clicking on single customer in list going through customer details page:

1) route defined target html page , controller. 2) controller gets list of customers (ideally via service), available html page via controller (so controller mycontroller mycont, means list should available via mycont.mycustomers 3) directive defined display customer row's details (name/address, plus clickable link passes customer number parameter details page) 4) html page has ng-repeat display of mycustomer in mycustomers, using directive. so, want pass single customer details directive via attr's (for dependency injection) , them displayed each customer...

(alternatively, of course, directive take in customers , display of them)

so, question whether correct approach take, or missing way these apps need flow? i've tried unsuccessfully working (posting home , attempt @ work... i'll post attempt if ppl think valuable, first question whether overall approach inherently flawed or not)

and then, secondly, data each customer passed directive, i'm assuming need pass fields in in html page has directive in it, passing {{ mycustomer }}... correct? (can assume controller have finished getting data before ng-repeat tries cycle through customers , send data directive, or not, in case should passing data via other mechanism?)

i can't seem find examples on web tie component based directives, routing via controller, passing data controller directive, appreciated!

thanks!!


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -