angular7中常见细节使用

Angular中修改第三方组件的样式

::ng-deep img
    width 100%
    height 100%
    border 1px solid red

请求本地json文件数据

login.component.ts

getVirtualFactoryList() {
      this.http.doGet('assets/mock/x.json').subscribe((data: any) => {
           this.options = data.result;
           console.log(data);
       });
 }

http.server.ts

public api = 'http://localhost:4200/';
constructor(public http: HttpClient) {}

// get请求
doGet(url: any, params?: any) {
    return new Observable(observer => {
        this.http.get(this.api + url).subscribe(response => {
            observer.next(response);
        });
    });
}
上一篇:javascript – 如何通过复选框将电子邮件保存到订阅者?


下一篇:10activiti - 入门demo(Eclipse)