Yii2 and Angular JS


(Folumikeidowu) #1

I want to develop an application that has admin, web and mobile section. How do I integrate AngularJS and REST API into Yii2 to achieve this.

I have 3 interfaces:

  1. Backend (admin - setup) => http://localhost/lms/admin/index.php

7607

admin.PNG

  1. Frontend (Teacher - module) => http://localhost/lms/index.php

7608

teacher.PNG

  1. Student module => This is the student interface. I want it to be for mobile app using yii2 and angularJS.

7609

yii2.PNG

Since I’ve used backend for admin, and frontend for teacher, How do I go about the student interface.

Or is there a better way to do it.

Thanks


#2

Example how to set up an api in app-advanced: http://budiirawan.com/setup-restful-api-yii2/

Another example (not an app-advanced): https://github.com/samdark/yiifeed/tree/master/modules/api

AngularJS & Yii2: http://blog.neattutorials.com/angularjs-yii2-part-1-routing/


(Andrzej Bernat) #3

Hey,

Let me put my 2c. I would really avoid the way to integrate views, js and the API in one place. I would do that like this:

It will give you the freedom at the point where you want to replace the frontend or backend (api).

I’ve been using the approach in my projects like http://mikrokiosk.pl (only in polish but take a look at the widget presenting products - it is done exactly that way).

Cheers!


(Stefano Mtangoo) #4

I suggest you make student a nested module to allow versioning

app/modules/students/v1