I'm a bit confused on how to develop a web application using frameworks on both front-end (e.g. Angular) and back-end (e.g. Phalcon). Phalcon's documentation has bits like:
<?php
echo "<h1>Hello!</h1>";
echo Phalcon\Tag::linkTo("signup", "Sign Up Here!");
But wouldn't I be using Angular's {{ }}
templating notation to print things? So if I'm using Angular, do I really need to use Phalcon, or Laravel, or any other PHP MVC?
I guess I'm trying to ask on a very basic level: if I'm using Angular, can't I just use single PHP files on the back-end and not use a PHP MVC?
(sorry, I'm not sure how to word this question; I may re-edit)
The short answer to your question is: yes, you can just use a simple, non-mvc backend for your angular applications. In fact, that is a good thing to do.
You can still use an MVC framework if you like, but dynamically rendering data into HTML on the server side is something to avoid (though there are some exceptions).
I tend to recommend using a server-side language for exposing RESTful APIs which just respond with JSON data and then using static html/css/js (Angular) to handle user interactions, navigation, view states, data retrieval, etc.
You can use MVC both in the frontend (AngularJS) and in the backend. As @bentaldon wrote you can have an API that will offer data back to AngularJS.
The API (backend) application can easily have a very streamlined MVC framework with the View component rendering data in a format that you need in your AngularJS application (say JSON)
Should you decide to use a backend not in the form of an API then you can easily change the {{}} templating notation of AngularJS to avoid collisions.
An example that I can give you can be found here:
https://github.com/niden/phalcon-angular-harryhogfootball
Using AngularJS and Phalcon at the same time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With