在这里它使用pathmatch作为完整,当我删除此路径匹配时,它甚至不加载应用程序或运行项目
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { WelcomeComponent } from './home/welcome.component';
/* Feature Modules */
import { ProductModule } from './products/product.module';
@NgModule({
imports: [
BrowserModule,
HttpModule,
RouterModule.forRoot([
{ path: 'welcome', component: WelcomeComponent },
{ path: '', redirectTo: 'welcome', pathMatch: 'full' },
{ path: '**', redirectTo: 'welcome', pathMatch: 'full' }
]),
ProductModule
],
declarations: [ …
Run Code Online (Sandbox Code Playgroud) 运行webpack后出现此错误.Webpack全局安装,我正在运行Node
PS D:\Projects\ng2-admin-master> ng serve
Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\Projects\ng2-admin-master\node_modules\html-webpack-plugin\lib\compiler.js:11:26)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\Projects\ng2-admin-master\node_modules\html-webpack-plugin\index.js:7:21)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
PS D:\Projects\ng2-admin-master>
Run Code Online (Sandbox Code Playgroud) 我已经按照安装部分中给出的步骤使用angular-cli生成了一个项目.项目正在运行.但我必须通过在浏览器中键入http:// localhost:4200 /手动打开浏览器.
有可能当用户执行"ng serve"或"npm start"命令时,浏览器会自动打开吗?
如果有可能请告诉我,或者给我任何解决方案.
这是我在 HTML 页面中使用的代码。在我的角度模块中,我导入所有相关的东西。但总是说这个错误是因为背景。请帮忙。我不知道这个背景。如果有人可以解释一下这个错误是什么以及为什么会出现?
<div class="animated fadeIn">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header">
<i class="fa fa-align-justify"></i> Bootstrap Modals
</div>
<div class="card-block">
<!-- Button trigger modal -->
<button type="button" class="btn btn-secondary" data-toggle="modal" (click)="smallModal.show()">
Launch small modal
</button>
</div>
</div>
</div>
<!--/.col-->
</div>
<!--/.row-->
</div>
<div bsModal #smallModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Modal title</h4>
<button type="button" class="close" (click)="smallModal.hide()" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div …
Run Code Online (Sandbox Code Playgroud) 结果始终为“ on”。我想使它在打开和关闭时都得到两个结果。
<label class="switch switch-3d switch-primary switch-success">
<input type="checkbox" (change)="isChangeLimitAccessToggle($event.target.value)" id="ifLimitAccess" class="switch-input">
<!-- [attr.disabled]="switchDisable?'':null" [checked]="switchEnable" -->
<span class="switch-label" data-on="Yes" data-off="No"></span>
<span class="switch-handle"></span>
</label>
Run Code Online (Sandbox Code Playgroud) npm ERR!从npm @ 5开始,npm缓存会因损坏问题而自我修复,并且保证从缓存中提取的数据是有效的。如果要确保所有内容都一致,请改用“ npm cache verify”。npm ERR!npm ERR!如果确定要删除整个缓存,请使用--force重新运行此命令。
npm ERR!可以在以下位置找到该运行的完整日志:npm ERR!C:\ Users \ janak \ AppData \ Roaming \ npm-cache_logs \ 2017-08-11T04_38_31_995Z-debug.log
这是我的三列的示例。我想自定义宽度大小。
resetPassword: {
title: this.gridTittle["ResetPassword"],
type: 'custom',
renderComponent: UserPasswordResetComponent,
filter: false
},
userName: {
title: this.gridTittle["UserName"],
},
roleTypeDescription: {
title: this.gridTittle["UserType"],
type: 'text',
filter: false
},
Run Code Online (Sandbox Code Playgroud) Angular默认提供生命周期钩子ngOnInit()和ngOnChanges().如果我们已经有ngOnChanges,为什么要使用ngOnInit?还有构造函数.