小编Env*_*vil的帖子

流浪汉 - Errno :: EADDRNOTAVAIL与流浪汉版本1.9.3

我一直在尝试安装Laravel Homestead,我一直在关注不同的教程,但总是当我达到我必须执行的程度时,我发现了vagrant up这个错误:

$ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Importing base box 'laravel/homestead'...
==> homestead-7: Matching MAC address for NAT networking...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Setting the name of the VM: homestead-7
==> homestead-7: Destroying VM and associated drives...
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in `initialize': La direcci?n solicitada no es v?lida en este contexto. - connect(2) for "0.0.0.0" port 8000 (Errno::EADDRNOTAVAIL)
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in `new'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in `block in …
Run Code Online (Sandbox Code Playgroud)

vagrant laravel homestead vagrant-windows

11
推荐指数
2
解决办法
5036
查看次数

Store 没有提供者!注射错误Error

应用程序组件.html

<page-router-outlet></page-router-outlet>
Run Code Online (Sandbox Code Playgroud)

app.component.ts

import 'rxjs/add/operator/let';
import { Component, ViewEncapsulation } from '@angular/core';
import { EchoesState, getSidebarCollapsed$ } from './core/store';
import { Store } from '@ngrx/store';

@Component({
   selector: "ns-app",
   templateUrl: "app.component.html",
})
export class AppComponent {
  constructor(private store: Store<EchoesState>){}
}
Run Code Online (Sandbox Code Playgroud)

app.module.ts

import 'nativescript-localstorage';
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";

import { NativeScriptRouterModule } from "nativescript-angular/router";
import { NativeScriptFormsModule } from "nativescript-angular/forms";

import { AppRoutingModule } from "./app.routing";
import { AppComponent } from "./app.component";

import …
Run Code Online (Sandbox Code Playgroud)

nativescript ngrx angular2-nativescript ngrx-store angular-nativescript

3
推荐指数
1
解决办法
6372
查看次数

通过 Javascript 获取数组或对象的名称

我有一个非常愚蠢但令人困惑的问题。我们如何获得一个存在的数组或对象的名称?

例如:

thisObject={ first:1, second:2};
thisArray=[1,2,3,4]
Run Code Online (Sandbox Code Playgroud)

我想得到字符串“thisObject”、“thisArray”。

我们怎样才能得到它?

非常感谢。


编辑:

更具体的。我想做这样的事情:console.log(someFunction(thisObject))

然后它返回

"thisObject"


编辑-2:

const firstArray=[1,2,3] 
const secondArray=["a","b"] 
const render=(arr)=>arr.map(arrr=>console.log(Object.keys({arr})[0]))
render(firstArray)
render(secondArray)
Run Code Online (Sandbox Code Playgroud)

它会回来

"arr" "arr" 
Run Code Online (Sandbox Code Playgroud)

代替

"firstArray" "secondArray"
Run Code Online (Sandbox Code Playgroud)

javascript arrays object

3
推荐指数
1
解决办法
2万
查看次数

使用 ControlContainer 创建可重用 matInput 组件时,“没有带有名称的表单控件的值访问器”

我按照本指南创建ControlContainer可重用表单,成功创建了可重用表单组,但是当我尝试使用 创建可重用表单元素时matInput,遇到了No value accessor错误。这是my-form-field.ts文件:

import { Component, Input, OnInit } from '@angular/core';
import {
  ControlContainer,
  FormBuilder, FormControl,
  FormGroup,
  FormGroupDirective,
} from '@angular/forms';

@Component({
  selector: 'my-form-field',
  template: `
    <mat-form-field>
      <mat-label>{{label}}</mat-label>
      <input matInput [formControlName]="formControlName">
    </mat-form-field>
  `,
  viewProviders: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
})
export class MyFormFieldComponent implements OnInit {
  @Input() formControlName: string;
  @Input() label: string;
  formGroup: FormGroup;

  constructor(private ctrlContainer: FormGroupDirective, private formBuilder: FormBuilder) {

  }

  ngOnInit(): void {
    this.formGroup = this.ctrlContainer.form; …
Run Code Online (Sandbox Code Playgroud)

code-reuse angular-material angular angular-reactive-forms controlvalueaccessor

1
推荐指数
1
解决办法
9581
查看次数

Javascript 类在函数内调用函数

function ObjectProvider() {
    this.url = "ajax/inbounds.php"
    this.inBounds = function () {
        this.removeMarkers();
        var url_string = this.url;
        $.getJSON(url_string, function (data) {
            for (i = 0; i != data.length; ++i) {
                this.createObject(data[i]);
            }
        });
    };
    this.createObject = function (_data) {};
    this.removeMarkers = function () {};
};
Run Code Online (Sandbox Code Playgroud)

所以这条线

this.createObject( data[i] );
Run Code Online (Sandbox Code Playgroud)

有一些问题,但是

this.removeMarkers();
Run Code Online (Sandbox Code Playgroud)

工作正常。

这两个函数都在 ObjectProvider 对象中定义。已尝试添加一个名为 test() 的函数,但不喜欢在 JSON 回调函数中调用任何内容。

javascript prototypejs

0
推荐指数
1
解决办法
5660
查看次数