Yii 2 & Angularjs

I am about to start a new project and decided to upgrade to Yii 2.

Also, I am interested in taking the plunge in AngularJS as it seems to be the future.

I have experience in Yii 1, no experience in Yii 2, and did 1 online intro course in Angular.

Did anyone manage to build a Yii/Angular project?

Are there interesting resources online?

Can you already think of tips, tricks, best practices and drawbacks?

Here are my thoughts so far:

  • Both Yii and Angular are MVCs, is that a problem?

  • I assume I will need to consume data from Yii as JSON instead of standard HTML views.

  • How to structure the folders?

  • What role will Yii Views have now?

I stumbled upon ng-boilerplate (http://joshdmiller.github.io/ng-boilerplate) which bundles other projects and changes the default folder structure of angular to use best practices. But I wonder how it would play with Yii.

Not really. You can serve JSON and, probably, templates using Yii while rendering data into templates using AngularJS.

Correct.

The way AngularJS guide proposes if we’re talking about angular stuff.

These are either unused or used to serve templates.

Hi Alex,

can you help me suggest project structure? I have admin module which is purely Yii2 and want front-end to be handled with Angularjs.

Now I’m stuck with how to make a structure where by I will have angularjs app without disturbingmy admin module.

Here are what I thought and roadblocks

  1. Make Angularjs asset bundle and make site/index view angular (Problem: how do I deal with angular partial views et al)

  2. Make angular app (completely html and redirect to Yii2 App for admin issues) (Problem: looks to me amateurish and unprofessional)

So am out of ideas on best project structure.

Thanks

I’d create something like advanced app.