所以,我在main.ts中有一个函数
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import * as $ from 'jquery'
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
export function view_user(id) {
...some jQuery stuff
}
我在这样的组件中使用此功能:
import { view_user } from 'src/main';
...
show_user(id){
view_user(id)
}
我收到此警告:
检测到循环依赖:src / app / profile / profile.component.ts-> src / main.ts-> src / app / app.module.ts-> src / app / app-routing.module.ts -> src / app / profile / profile.component.ts