markdown errores para angular

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown errores para angular相关的知识,希望对你有一定的参考价值。

## Can't bind to 'ngModel' since it isn't a known property of 'input'

### resuelve
Yes that's it, in the app.module.ts, I just added :
```
import { FormsModule } from '@angular/forms';

[...]

@NgModule({
  imports: [
    [...]
    FormsModule
  ],
  [...]
})
```  

## Directives is not assignable to parameter of type 'Component'
### este codigo:
```
import { Component } from '@angular/core';
import { HeaderComponent } from './components/header/header.component'
@Component({
  selector: 'my-app',
  template: '<h1>Hello</h1><header></header>',
  directives: [HeaderComponent]  <== here 
})
export class AppComponent { }
```

### resuelve:

__directives__ property has been removed in RC.6

You should move it to declarations property of your NgModule decorator
```
@NgModule({
  imports:      [ BrowserModule ],
  declarations: [ AppComponent, HeaderComponent ], <== here
  bootstrap:    [ AppComponent ]
})
export class AppModule { }
```

## @angular/http/index has no exported member of HTTP_PROVIDERS
### resuelve:

```
HTTP-PROVIDERS is not used anymore. Import HttpModule to your ngModule instead and add it to your imports.
import { HttpModule } from '@angular/http';

@NgModule({
  imports: [
    ...
    HttpModule,   <=== nota esto
  ],
  declarations: [...],
  bootstrap: [ .. ],
  providers: [ ... ],
})
```
## get title list from json placeholder (jsonplaceholder)
### resolve: 
__Step 1. Create A service__
```
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import  'rxjs/add/operator/map';
import  'rxjs/add/operator/do';
import  'rxjs/add/operator/catch';

@Injectable()
export class ProductService{
  private _productUrl = 'api url';
  constructor (private _http:Http){}

  getProductsHttp():Observable<any> {
      return this._http.get(this._productUrl)
          .map((response: Response) => <any> response.json())
          .do(data => console.log('All: ' +  JSON.stringify(data)))
          .catch(this.handleError);
  }

  private handleError(error: Response) {
      console.error(error);
      return Observable.throw(error.json().error || 'Server error');
  }
  ```
  
  __Step 2 Change the Component like below__
  ```
  constructor(private _producrService:ProductService)  {

  }
  ngOnInit() {
        this._producrService.getProductsHttp()
              .subscribe(products => this.products = products,
                         error => this.errorMessage = <any>error);

  }
  ```
  
  



以上是关于markdown errores para angular的主要内容,如果未能解决你的问题,请参考以下文章

markdown HERRAMIENTA PARA CONSTRUCION

markdown Reglas para el复数

markdown 插件para intellij

markdown 设置Vagrant para Rails 5.2

markdown 配置AMPPS para directorios personales

markdown Para aprender Ruby e Rails