i have php app uses smarty. not using standard mvc framework achieves same aim follows:
each click causes page transition calling structured url (akin rest calls) interpreted apache rewrite rules (in .htaccess) specific query parameters attached index.php file.
the index.php determines page or sub-page load, performs whatever controller logic , assembles display info, loads smarty vars , displays
i read somewhere it's not advisable mix front , end mvc frameworks. need convert app in short timeframe possible.
the typical combination have angular call php rest backend. rather keep deep business logic in end (not crud actions) have php send angular data displayed.
i'm pretty new angular: there makes technically impossible or suboptimal?
the typical combination have angular call php rest backend.
typical, yes. not absolutely necessary. webservice can structured way want.
however rather keep deep business logic in end (not crud actions) have php send angular data displayed.
i might misinterpreting but, keeping business logic in backend how supposed be. rest not crud.
the index.php determines page or sub-page load, performs whatever controller logic , assembles display info, loads smarty vars , displays
the problem here "controller logic". can gather you're trying replace server-side template engine client side template engine. that's fine. angularjs not template engine , there key points might make bad choice in case:
angular meant work single page website/app. means expects pageflow , view logic, instance, controlled client side. keeping "controller" logic in backend, turn angular extremely inefficient , heavy template engine.
it expects backend serve (structured) data, not "full" view. sure, nothing stops requesting php document. kind of defeats purpose of using angular.
it plays nicely rest because of stateless nature. can bit of challenge since deviates usual php setup. biggest example logins , php sessions.
usually, in php setups, user authenticates through login form , server responds cookie, containing phpsessid. while cookie gets passed around, user stays logged in , appropriate ui/view/data displayed. adapt logic angularjs single page app requires bit of work. this article might you
i'm pretty new angular: there makes technically impossible or suboptimal?
in short... impossible no, far it. suboptimal maybe...
Comments
Post a Comment