Angularjs Asp.Net Core SpatTemplate永远无法使用有角度的材质
几周来,我一直试图从微软公司将有棱角的材料放入SpaTemplate中。有人能帮我理解为什么我不能遵循角材料的启动指南并让它工作吗?有人能帮我得到一个项目,我可以开始从SpaTemplate角度材料的工作 我已关闭服务器端预渲染,因为我知道这会导致问题。但除此之外,我还尝试安装了Angular Material,我在cmd中看到了一些错误。我导入并添加MaterialModule,然后看到更多关于Angularjs Asp.Net Core SpatTemplate永远无法使用有角度的材质,angularjs,angular,asp.net-core,Angularjs,Angular,Asp.net Core,几周来,我一直试图从微软公司将有棱角的材料放入SpaTemplate中。有人能帮我理解为什么我不能遵循角材料的启动指南并让它工作吗?有人能帮我得到一个项目,我可以开始从SpaTemplate角度材料的工作 我已关闭服务器端预渲染,因为我知道这会导致问题。但除此之外,我还尝试安装了Angular Material,我在cmd中看到了一些错误。我导入并添加MaterialModule,然后看到更多关于“ng-template”不是已知元素的错误。我已经从导入数组中删除了UniversalModule
“ng-template”不是已知元素的错误。我已经从导入数组中删除了UniversalModule,这会导致更多问题
如果有人能帮忙的话,我就在这里
我也是唯一一个来自Angular 1.x的开发者,而且我真的一点也不感兴趣吗?Angular 1很容易开发,设置也不难,添加外部代码就像复制和粘贴一样简单。Angular 2感觉他们制作了一个非常棒的框架,然后在服务器上托管时,没有人知道如何使用它。我从core 2刚刚发布的新模板开始。我所有的东西都在工作,除了桌子…不知道为什么还有那张
尝试启动和其他,但没有成功。最接近材料。只是还没有表格,我不确定我是否理解数据源
希望这有帮助…还是个新手
在进行更改后,不要忘记手动重建网页包。
webpack--config webpack.config.vendor.js
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',
'hammerjs/hammer',
"@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: false },
resolve: { extensions: [ '.js' ] },
module: {
rules: [
{ test: /\.(png|woff|woff2|eot|ttf|svg|gif|jpg)(\?|$)/, use: 'url-loader?limit=100000' }
]
},
output: {
publicPath: 'dist/',
filename: '[name].js',
library: '[name]_[hash]'
},
plugins: [
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/11580
new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/14898
new webpack.IgnorePlugin(/^vertx$/) // Workaround for https://github.com/stefanpenner/es6-promise/issues/100
]
};
const clientBundleConfig = merge(sharedConfig, {
entry: {
// To keep development builds fast, include all vendor dependencies in the vendor bundle.
// But for production builds, leave the tree-shakable ones out so the AOT compiler can produce a smaller bundle.
vendor: isDevBuild ? allModules : nonTreeShakableModules
},
output: { path: path.join(__dirname, 'wwwroot', 'dist') },
module: {
rules: [
{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: isDevBuild ? 'css-loader' : 'css-loader?minimize' }) }
]
},
plugins: [
extractCSS,
new webpack.DllPlugin({
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
name: '[name]_[hash]'
})
].concat(isDevBuild ? [] : [
new webpack.optimize.UglifyJsPlugin()
])
});
const serverBundleConfig = merge(sharedConfig, {
target: 'node',
resolve: { mainFields: ['main'] },
entry: { vendor: allModules.concat(['aspnet-prerendering']) },
output: {
path: path.join(__dirname, 'ClientApp', 'dist'),
libraryTarget: 'commonjs2',
},
module: {
rules: [ { test: /\.css(\?|$)/, use: ['to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize' ] } ]
},
plugins: [
new webpack.DllPlugin({
path: path.join(__dirname, 'ClientApp', 'dist', '[name]-manifest.json'),
name: '[name]_[hash]'
})
]
});
return [clientBundleConfig, serverBundleConfig];
}
我使用app.module.shared从索引中删除asp渲染
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule} from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { RouterModule } from '@angular/router';
import { AppComponent } from './components/app/app.component';
import { NavMenuComponent } from './components/navmenu/navmenu.component';
import { HomeComponent } from './components/home/home.component';
import { FetchDataComponent } from './components/fetchdata/fetchdata.component';
import { CounterComponent } from './components/counter/counter.component';
import { HttpTestComponent } from './components/Httptest/httptest.component';
import { MaterialTesterComponent } from './components/Httptest/materialTester.component';
import { MaterialGridComponent } from './components/Httptest/materialgrid.component';
import { MaintService } from './Services/maint.service';
import {
MdButtonModule,
MdChipsModule,
MdProgressSpinnerModule,
MdCardModule,
MdDatepickerModule,
MdInputModule,
MdAutocompleteModule,
MdNativeDateModule,
MdCheckboxModule,
MdRadioModule,
MdSelectModule,
MdSliderModule,
MdSlideToggleModule,
MdMenuModule,
MdListModule,
MdGridListModule,
MdTabsModule,
MdProgressBarModule,
MdTableModule,
MdCoreModule,
MdExpansionModule,
} from '@angular/material';
import { CdkTableModule } from '@angular/cdk';
@NgModule({
declarations: [
AppComponent,
NavMenuComponent,
CounterComponent,
FetchDataComponent,
HomeComponent,
HttpTestComponent,
MaterialTesterComponent,
MaterialGridComponent,
],
imports: [
CommonModule,
HttpClientModule,
FormsModule,
ReactiveFormsModule,
CdkTableModule,
MdButtonModule,
MdChipsModule,
MdProgressSpinnerModule,
MdCardModule,
MdInputModule,
MdTabsModule,
MdExpansionModule,
MdDatepickerModule,
MdNativeDateModule,
MdCheckboxModule,
MdRadioModule,
MdListModule,
MdCoreModule,
MdProgressBarModule,
MdSelectModule,
MdSliderModule,
MdSlideToggleModule,
MdMenuModule,
MdGridListModule,
MdTableModule,
MdAutocompleteModule,
RouterModule.forRoot([
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{ path: '**', redirectTo: 'home' }
])
],
providers: [
MaintService
]
})
export class AppModuleShared {
}