asp.net core/angular4未处理的承诺拒绝:ApplicationRef没有提供程序
正在尝试将angular4用于asp.net核心项目 使用此repo进行角度临时调整 不知道是什么原因造成的,有没有办法获得有关此错误类型的更多详细信息 获取此错误asp.net core/angular4未处理的承诺拒绝:ApplicationRef没有提供程序,asp.net,angular,webpack,asp.net-core,Asp.net,Angular,Webpack,Asp.net Core,正在尝试将angular4用于asp.net核心项目 使用此repo进行角度临时调整 不知道是什么原因造成的,有没有办法获得有关此错误类型的更多详细信息 获取此错误 vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:83954 Unhandled Promise rejection: No provider for ApplicationRef! ; Zone: <root> ; Task: Promise.then ;
vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:83954 Unhandled Promise rejection: No provider for ApplicationRef! ; Zone: <root> ; Task: Promise.then ; Value: Error: No provider for ApplicationRef!
at injectionError (vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:12189)
at noProviderError (vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:12227)
at ReflectiveInjector_._throwOrNull (vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:13728)
at ReflectiveInjector_._getByKeyDefault (vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:13767)
at ReflectiveInjector_._getByKey (vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:13699)
at ReflectiveInjector_.get (vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:13568)
at AppModuleInjector.createInternal (module.ngfactory.js? [sm]:1)
at AppModuleInjector.NgModuleInjector.create (vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:14495)
at NgModuleFactory.create (vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:14468)
at vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:15709 Error: No provider for ApplicationRef!
at injectionError (http://localhost:5000/dist/vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:12189:86)
at noProviderError (http://localhost:5000/dist/vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:12227:12)
at ReflectiveInjector_._throwOrNull (http://localhost:5000/dist/vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:13728:19)
at ReflectiveInjector_._getByKeyDefault (http://localhost:5000/dist/vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:13767:25)
at ReflectiveInjector_._getByKey (http://localhost:5000/dist/vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:13699:25)
at ReflectiveInjector_.get (http://localhost:5000/dist/vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:13568:21)
at AppModuleInjector.createInternal (ng:///AppModule/module.ngfactory.js:122:51)
at AppModuleInjector.NgModuleInjector.create (http://localhost:5000/dist/vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:14495:76)
at NgModuleFactory.create (http://localhost:5000/dist/vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:14468:18)
at http://localhost:5000/dist/vendor.js?v=8G5nuphpleAMB8hDVj0v8l9es64guglhqGWIwYdey3M:15709:61
PromotorSliderComponent.ts
import { Component } from '@angular/core';
@Component({
selector: 'promo-slider',
templateUrl: './promoslider.component.html'
})
export class PromoSliderComponent {
}
app.module.shared.ts
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppComponent } from './components/app/app.component'
import { NavMenuComponent } from './components/navmenu/navmenu.component';
import { FooterComponent } from './components/footer/footer.component';
import { HomeComponent } from './components/home/home.component';
import { PromoSliderComponent } from './components/home/promoslider.component';
export const sharedConfig: NgModule = {
bootstrap: [ AppComponent ],
declarations: [
AppComponent,
NavMenuComponent,
FooterComponent,
PromoSliderComponent,
HomeComponent
],
imports: [
RouterModule.forRoot([
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{ path: '**', redirectTo: 'home' }
])
],
};
addp.module.client.ts
import { NgModule } from '@angular/core';
//import { BrowserModule } from '@angular/platform-browser';
//import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { sharedConfig } from './app.module.shared';
//import { RouterModule } from '@angular/router';
@NgModule({
bootstrap: sharedConfig.bootstrap,
declarations: sharedConfig.declarations,
imports: [
HttpModule,
...sharedConfig.imports,
],
providers: [
{ provide: 'ORIGIN_URL', useValue: location.origin }
]
})
export class AppModule {
}
问题2:在asp.net核心项目中使用angular使我有义务使用组件而不是partials。有没有一种方法可以把偏音和角音连用?我不想从服务获取所有数据,或者我必须这样做吗
import { NgModule } from '@angular/core';
//import { BrowserModule } from '@angular/platform-browser';
//import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { sharedConfig } from './app.module.shared';
//import { RouterModule } from '@angular/router';
@NgModule({
bootstrap: sharedConfig.bootstrap,
declarations: sharedConfig.declarations,
imports: [
HttpModule,
...sharedConfig.imports,
],
providers: [
{ provide: 'ORIGIN_URL', useValue: location.origin }
]
})
export class AppModule {
}