试图让Angular Material或任何第三方控制集真正地使用这个新模板而苦苦挣扎.在这个新模板中,webpack分为TreeShakable和NonTreeShakable.此外,app.module现在是app.module.shared,app.module.browser,app.module.server.
由于我试图使其工作,应用程序将仅使用app.module.browser中配置的模块运行,但材料标签未得到处理.尝试简单的东西并尝试按钮.我没有收到任何错误,但没有错误.我在Plunker中找到了他们的例子,复制了它生成的内容,它显示正确告诉我,我至少得到了正确的CSS.
包括webpack供应商配置作为起点,因为这似乎是关键因为它如何捆绑css和js.
TIA
Webpack.vendor
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const merge = require('webpack-merge');
const treeShakableModules = [
'@angular/animations',
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/forms',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'@angular/material',
'@angular/cdk',
'zone.js'
];
const nonTreeShakableModules = [
'bootstrap',
'jqwidgets-framework',
"@angular/material/prebuilt-themes/indigo-pink.css",
'bootstrap/dist/css/bootstrap.css',
'font-awesome/css/font-awesome.css',
'es6-promise',
'es6-shim',
'event-source-polyfill',
'jquery',
];
const allModules = treeShakableModules.concat(nonTreeShakableModules);
module.exports = (env) => {
const extractCSS = new ExtractTextPlugin('vendor.css');
const isDevBuild = !(env && env.prod);
const sharedConfig = {
stats: { modules: …Run Code Online (Sandbox Code Playgroud) 我已经开始使用asp.net core 2发行版中的角度spa模板.我首先注意到在更改VS并保存之后,浏览器会刷新但内容是重复的,三重的....等等.
我现在正在使用一个路由器出口区域进行一些基本的组件路由.我试图在html和路由器中使用routerlink并在代码中导航和导航,并获得相同的结果.在第一次导航时,将加载新内容,但不会清除原始内容.如果我再次点击导航按钮,它会正确重新加载.我还通过直接进入浏览器来测试路径,一切正常.由于我在开发模式下运行,不知道它是否与实时刷新有关,或者是否有.net模板实现了角度spa.
什么都不花哨,没有护卫或任何其他东西
喜欢在同一个项目中拥有mvc webapi控制器的能力,但是到目前为止确实很痛苦.
*****************
Routing Module
@NgModule({
imports: [
RouterModule.forRoot([
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{ path: 'maint/uom/:id', component: UomDetailComponent },
{ path: 'maint/uom', component: UomMaintenanceComponent },
{ path: 'httptest', component: HttpTestComponent},
{ path: '**', redirectTo: 'home' }
]),
],
exports: [RouterModule]
})
export class AppRoutingModule { }
*******************************************
//navigate in ts file
showUomDetail(uom: IUom) {
console.log(uom);
this._router.navigate(['/maint/uom', uom.id]);
// this._router.navigateByUrl('/maint/uom/5');
//route to detail page
}
***** …Run Code Online (Sandbox Code Playgroud)