我已经安装了nvm(带zsh shell的ubuntu)和两个节点版本:v6.11.5和v9.0.0,nvm中的默认版本是v9.0.0
每次我需要更改节点版本
$ nvm list
v6.11.5
-> v9.0.0
system
default -> node (-> v9.0.0)
node -> stable (-> v9.0.0) (default)
stable -> 9.0 (-> v9.0.0) (default)
$ nvm v6
Run Code Online (Sandbox Code Playgroud)
我怎么能改变nvm版本默认定义v6.11.5?
可以使用angular cli生成服务,并在app.module.ts中将其作为提供程序添加到一个步骤中,或者使用ng g service命令中的特殊选项?
执行时:
$ ng g service services/backendApi
installing service
create src/app/services/backend-api.service.spec.ts
create src/app/services/backend-api.service.ts
WARNING Service is generated but not provided, it must be provided to be used
Run Code Online (Sandbox Code Playgroud)
在它旁边,(并根据警告消息)我通常使用文本编辑器将它添加到app.module.ts上的提供程序部分:
@NgModule({
declarations: [
AppComponent,
...
],
imports: [
....
],
providers: [BackendApiService],
bootstrap: [AppComponent]
})
Run Code Online (Sandbox Code Playgroud)
只需一步就可以实现自动化吗?
在angular2中,可以在@Component元素中定义提供者
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css'],
providers : [ DataService ]
})
export class HomeComponent implements OnInit {
...
}
Run Code Online (Sandbox Code Playgroud)
还有一个
@NgModule({
declarations: [
...
],
imports: [
...
],
providers: [ DataService ],
bootstrap: [AppComponent ]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
在@NgModule或@Component中定义提供程序有什么区别?如果我应该选择两个中的一个,那么定义提供者的更好的地方是什么?
I am doing TDD with mocha and chai to test some NodeJS scripts, and I have to run "mocha" every time that I want to run the test again.
Is there a way to setup mocha and chai to run the test just after I save the source file? like an option "mocha -–live-reload" (that is just an example...)
我正在使用angular-cli和bootstrap4进行应用程序,但是当我对Glyphicons进行一些引用时,图标不会出现.例如,当我添加以下代码时:
<button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-star" aria-hidden="true"></span> Star
</button>
Run Code Online (Sandbox Code Playgroud)
我在我的角度项目中执行了bootstrap安装:
$ npm install --save bootstrap@4.0.0-alpha.6
Run Code Online (Sandbox Code Playgroud)
我应该做任何额外的步骤让Glyphicons进入bootstrap?我应该安装另一个特定于Glyphicons的npm包吗?
如何在MongoDB中的多个文档中重命名字段?我有一个像这样的元素的集合,我想在所有集合中通过" userName " 重命名字段" name "
{
"name" : "luisPerez",
"address" : "Gaiman",
"addressFmt" : "Gaiman, Chubut Province, Argentina",
"loc" : {
"type" : "Point",
"coordinates" : [ -65.4920111, -43.2895976 ]
},
}
Run Code Online (Sandbox Code Playgroud) angular ×1
angular-cli ×1
bootstrap-4 ×1
glyphicons ×1
javascript ×1
mocha.js ×1
mongodb ×1
node.js ×1
nvm ×1
typescript ×1
version ×1