3.2 Thiết kế CSDL
- Cơ sở dữ liệu được tạo trên mockapi.io, sử dụng http service và thư viện rxjs để tương tác vs dữ liệu
Dữ liệu tài liệu và bài giảng được lưu trên mockapi
[
{
"id": "1",
"name": "Khoảng đồng biến, nghịch biến của hàm số - Phần 1",
"src": "https://drive.google.com/file/d/0BySCcyjipPx8VElCSFFJSXVFUzA/preview?autoplay=1" frameborder="0" allowfullscreen="0"",
"title": "Phần I. HÀM SỐ",
"src1": "https://drive.google.com/file/d/0BySCcyjipPx8YUxLM0hlZmN4ZEk/view?usp=sharing",
"src2": "https://drive.google.com/file/d/0BySCcyjipPx8SkZmMjlJdkpmc2M/view?usp=sharing"
},
{
"id": "2",
"name": "Khoảng đồng biến, nghịch biến của hàm số - Phần 2",
"src": "https://drive.google.com/file/d/0BySCcyjipPx8SDEtNUVyUVV1V2M/preview?autoplay=1" frameborder="0" allowfullscreen="0"",
"title": "Phần I. HÀM SỐ",
"src1": "https://drive.google.com/file/d/0BySCcyjipPx8YUxLM0hlZmN4ZEk/view?usp=sharing",
"src2": "https://drive.google.com/file/d/0BySCcyjipPx8SkZmMjlJdkpmc2M/view?usp=sharing"
},
{
"id": "3",
"name": "Cực trị của hàm số - Phần 1",
"src": "https://drive.google.com/file/d/0BySCcyjipPx8Z1BHeUw1ZVJwVVE/preview?autoplay=1" frameborder="0" allowfullscreen="0"",
"title": "Phần I. HÀM SỐ",
"src1": "https://drive.google.com/file/d/0BySCcyjipPx8TEdHS0pad3g5WGs/view?usp=sharing",
"src2": "https://drive.google.com/file/d/0BySCcyjipPx8MWt4NG5mY3JCTk0/view?usp=sharing"
},
{
"id": "4",
"name": "Cực trị của hàm số - Phần 2",
"src": "https://drive.google.com/file/d/0BySCcyjipPx8QzVOZkpGNnFHeHM/preview?autoplay=1" frameborder="0" allowfullscreen="0"",
"title": "Phần I. HÀM SỐ",
"src1": "https://drive.google.com/file/d/0BySCcyjipPx8TEdHS0pad3g5WGs/view?usp=sharing",
"src2": "https://drive.google.com/file/d/0BySCcyjipPx8MWt4NG5mY3JCTk0/view?usp=sharing"
},
{
"id": "5",
"name": "Khảo sát hàm số bậc nhất trên bậc nhất",
"src": "https://drive.google.com/file/d/0BySCcyjipPx8Z3FRZDFPcmtlcmc/preview?autoplay=1" frameborder="0" allowfullscreen="0"",
"title": "Phần I. HÀM SỐ",
"src1": "https://drive.google.com/file/d/0BySCcyjipPx8RzZvRk1zaTBJZ2s/view?usp=sharing",
"src2": "https://drive.google.com/file/d/0BySCcyjipPx8MkxnejlmX1l0YjA/view?usp=sharing"
},
{
"id": "6",
"name": "Khảo sát hàm số bậc hai trên bậc nhất",
"src": "https://drive.google.com/file/d/0BySCcyjipPx8TXN0RDZvalF2X1U/preview?autoplay=1" frameborder="0" allowfullscreen="0"",
"title": "Phần I. HÀM SỐ",
"src1": "https://drive.google.com/file/d/0BySCcyjipPx8MWNmbFVRYks0N2s/view?usp=sharing",
"src2": "https://drive.google.com/file/d/0BySCcyjipPx8Ylk0SVM2UW1UMjg/view?usp=sharing"
},
{
"id": "7",
"name": "Khảo sát hàm số bậc ba",
"src": "https://drive.google.com/file/d/0BySCcyjipPx8THdTQW9YUHhLOTg/preview?autoplay=1" frameborder="0" allowfullscreen="0"",
"title": "Phần I. HÀM SỐ",
"src1": "https://drive.google.com/file/d/0BySCcyjipPx8NmpyTVhoemI3ODA/view?usp=sharing",
"src2": "https://drive.google.com/file/d/0BySCcyjipPx8TENPb2p2OXlLekU/view?usp=sharing"
}
]
Sử dụng http service và thư viện rxjs để tương tác vs dữ liệu
import{Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import{Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/map';
@Injectable()
export class BaigiangService {
private apiUrl="https://590f828127cbd50011191491.mockapi.io/api/Baigiang/";
constructor(private _http: Http){
}
GetList(): Observable<any[]> {
return this._http.get(this.apiUrl).map((response: Response) => response.json())
}
GetSingle(id: number): Observable<any> {
return this._http.get(this.apiUrl + id).map((response: Response) => response.json())
}
}
Video bài giảng, ảnh: Các video, ảnh được sử dụng công khai trên các trang web: hocmai.vn, youtube,....
Tài liệu và các dữ liệu khác: Tổng hợp từ nhiều nguồn trên các trang mạng.