Which is best to use AngularJS or Twig with Symfony2 - angularjs

I just need to build a website using Symfony2 but that website need to be pretty much SEO friendly. But as i heard AngularJS + Symfony in not much SEO frindly than TWIG + Symfony. If it is not true what are the things that i can used to my AngularJS + Symfony website to be more SEO friendly.

You can perfectly use AngularJS in Twig templates, with Symfony2 server.
AngularJS is not just a template engine, but Twig yes, with particular file extension due to server side. Angular can be used in all templates engines containing HTML.
Some AngularJS functionalities cannot be associated to Symfony2/Twig, or with difficulties, but you can easily build your application and do your markup in one/many twig templates, and call them using one or many routes.

Related

routing between angular js and symfony 2

How to make routing of a symfony application in angular js ,I have a symfony application with its templates and I can make the routing of the templates of this application by angular js
thanks you
I am not quite sure what you mean to ask, but probably you are looking for a way to access your Symfony routes in Angular.
In that case, take a look at the
FOSJsRoutingBundle
It provides a javascript object that you can use to generate urls much like the path() function in Twig. For example:
Routing.generate('your_route', {'foo': 'bar'})
You only need a few steps in order use use.

Creating first angularjs SPA with VS2015

I am new to AngularJS and need some advice on how to structure a SPA with Web API for an external search application
Di I have to use
•MVC / razor views (leave all routing and rendering to Angular)? or just use 1 VS2015 app [use angularjs SPA template for VS2015 or just an empty web application with angular file and a webapi project under same solution?
any examples would be helpful to understand
For angular structure I am reading Google best practice and John Papa
Well, I think what you ran into now. I can suggest two of the ways you can choose.
If you want to keep your backend and frontend together you can go for angularjs SPA template for VS2015. It would come with the build pipelines, bundles and everything you'd need. Now you can choose to render your single page of angular to be rendered with a MVC razor view (if you want to have any mechanisms where you'd want to include your dependencies through the razor view) or just go with a blank html and web api controllers on the back. But you'd end up using one environment for all and I think that's best if you're building the full project.
Now, for the other way around, you can start with an web api project. You can instantiate your angular project with it or somewhere else. You can use yeoman or any scaffolding tool you like and use your own JS toolings you'd like to use. You can do the same in the VS project too but this approach is better if you want to keep the frontend and backend flavor separate.
And I'd suggest using typescript too.

Is it possible in PyCharm to get code completion for Django AND AngularJS template tags?

I have Django / AngularJS project in PyCharm. As far as I can see, I can only enable Django template tags or AngularJS template tags. I understand that it's maybe complicated to have a such a feature that tags are automatically recognized as Django / AngularJS (but it's also sounds possible to me because of Django verbatim tag). But, I'm wondering is it possible to, let's say, define which folders in project are under what tag-control, or something like that? So in that case I could have strongly separated files with AngularJS tags as well as files with Django template files.

When to use angular template and when symfony template

I'm newbie web developer and I wonder what better and if it is a good question at all
I can retrieve the information that I need from the server side and make the template with angular, and I can do it with symfony too. whats better? whats the difference? when to use what?
what about forms? should I do it with symfony features or just with angular?
Please look the following points
You should use Angularjs template system. otherwise, the powerful feature of Directives.
Angularjs is decoupled with serverside code.
Angularjs only expects data (as JSON) from service end..not any HTML.
So template should be angularjs way.
So every service response from symfony should be JSON.
Angularjs totally avoiding to add HTML containers (through ajax) into web
pages. So here you can not use symfony template.

Do I need to convert JSP to C# to work with AngularJS and display server side data?

may be it is not a worthy question but i am new at angular js that is why going to ask this !
I have a small portal which has forms develop in jsp. Now my requirement is to display data from db on page by not moving to next page using Angular JS. Can i do this easily using jsp? or I should use c#? But transferring from jsp to c# will be quite daunting task! I shall be very great full if someone suggest a way using jsp.
Kind Regards.
If you can return/echo json files from JSP and you can consume requests (get,post,update delete) coming to it and redirect it to whatever handles the business logic (e.g controllers) then you are set to go. I believe with JSP you mean JSP + Java Servlets + Java Beans. Or in other words controllers better be Java classes. If that is your case, then you definitely can do that without converting to C# + ASP.NET ;)
Update:
The fact that you are only using JSP is good for starters but as you get better and want the application to scale more you need to move talking with the database in a Java class/servlet. JSP should be used only for presentation/templating and no business logic (if/else this that). Now you are consuming your request names from the form like username password etc.. With angularJS will be the same. The main difference is that angular will submit the form with ajax so no page redirection will happen (there are many questions in stackoverflow how to stop a form from submitting). Then the JSP will have to return/print some json and this will be returned to angularjs for rendering that in your page.In other words there will be no html in your JSP. All the templating will happen in the client side (Javascript/AngularJS)
Links:
Introduction to Angular.js in 50 Examples (part 1) https://www.youtube.com/watch?v=TRrL5j3MIvo
Introduction to Angular.js in 50 Examples (part 2) https://www.youtube.com/watch?v=6J08m1H2BME
Free Interactive AngularJS learning for Beginners https://www.codeschool.com/courses/shaping-up-with-angular-js
Head First Java Servlets and JSP Book ( http://www.headfirstlabs.com/books/hfsvlt/ )
Introduction to MVC with Java Servlets and JSP (http://blog.oscarscode.com/java/introduction-to-mvc-with-servlets-and-jsp/)
How to send JSON from JSP to Javascript: https://code.google.com/p/json-simple/wiki/JSPAndAJAXExamples
How to submit JSON form data to Server-side using AngularJS/ajax:
http://scotch.io/tutorials/javascript/submitting-ajax-forms-the-angularjs-way#submit-the-form-with-angular
Angular+ Java Restful services (http://draptik.github.io/blog/2013/07/13/angularjs-example-using-a-java-restful-web-service/)
Java + AngularJS Tutorial Part 1 (http://www.radcortez.com/java-ee-7-with-angular-js-part-1/)
Java + AngularJS Tutorial Part 2 (http://www.radcortez.com/java-ee-7-with-angular-js-crud-rest-validations-part-2/)
For Jquery Thinkers - Thinking in AngularJS If I have a Jquery Bcakground
"Thinking in AngularJS" if I have a jQuery background?

Resources