假设有两个角度2个应用程序,每个应用程序都使用Java开发的后端(app-1和app-2)部署在不同的包中。
是否可以从app 1进行ajax调用,并根据ajax调用检索到的数据,使用Ajax调用从app 2加载到app 1模块?
如果是,那怎么办?
示例:
import { Component, OnInit } from '@angular/core';
import { AppService } from './shared/app.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: [AppService]
})
export class AppComponent{
constructor(private appService: AppService){}
ngOnInit(){
let test = this.appService.checkUserPrivileges();
if(test.length > 1){
// make ajax calls that retrieves modules based on the test data
// inject ajax retrieved modules into module that contains the component somehow
}
}
}