简体   繁体   中英

Separating angular frontend for views from Yii backend Controller and Model

I'm trying to implement an angular frontend and a yii backend such that angular will handle all the routing and views whereas yii will just handle the controllers/model and database connection. Angular can send ajax requests for data which will be handled by the RESTfullYii extension. I've already implemented this through inserting angular code in the yii view files.

What I want though is both of them to be completely separate interacting only through the REST extension.

I'm trying to copy the structure in this app where the frontend is in a separate folder from yii's protected folder, but I don't know how to set the routing such that it will automatically render the index.html file from the angular-yii folder.

http://www.yiiframework.com/wiki/497/angularjs-frontend-connecting-it-with-a-yii-backend-rest-api-gallery-manager-demo-application/

Figured it out

Apparently just had to point the url to my angular files then then set the .htaccess rewrite engine on to make sure yii does not handle it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM