php - Sharing views for different controllers -


originally, php (and consequently laravel) developer. when write example simple blog app, have these routes:

/blog/:id -> singlecontroller /blog/:id/edit -> editcontroller /blog/new -> newcontroller

and because of laravel's form binding, use same template creating , editing blog post, so:

{{ form::model($post, array('route' => '...')) }}        {{ form::label('name', 'name') }}     {{ form::text('name') }} {{ form::close() }} 

which awesome, because laravel fill in text field if executed edit controller, , otherwise leave field empty. of course, example above simplified, because changes in action/route have taken care of too.

but currently, working on angularjs app (first time), , not find information best approach go this. advisable adopt same method angular too, or have been doing wrong along?

the reason why because makes easier change form: need apply changes 1 file/form, instead of two.

i recommend @ angular's ui router module, or ngroute module, structure code developers of angular intended. ui-router can assist rendering / swapping subviews. can define routes map particular states (i.e. combinations of views / html templates). each state has route defined , can have controller defined too.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -