将Angular样式注入到
中的解决方法,可以通过Angular提供的方法来实现,方法如下:@Component({
template:
,
styles: [Hello Angular!
h1 { color: blue; }
]
})
export class AppComponent {}
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component'; import { NgStyleInjectorModule } from 'ng-style-injector';
@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, NgStyleInjectorModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
通过以上步骤,就可以将Angular样式注入到
中,使得应用程序的样式可以更加灵活和可控。