directives angular js2

0
import { Component } from '@angular/core';
import { AuthDirective } from '../utils/auth.directive';
import { Router } from '@angular/router';
import { HttpClientService } from '../utils/http-client.service';
import { BaseAddressService } from '../utils/base-address.service';
import { AuthService, ClienteLogado } from '../utils/auth.service';
import {ModalUtilComponent} from '../utils/modal-util-component';

@Component({
templateUrl: './carrinho.component.html',
directives: [ Router, ModalUtilComponent ],

})

/src/app/carrinho/carrinho.component.ts (11,5): Argument of type '{ templateUrl: string; directives: typeof ModalUtilComponent[]; }' is not assignable to parameter of type 'Component'.
  Object literal may only specify known properties, and 'directives' does not exist in type 'Component'. 

What could be wrong?

Thank you very much!

    
asked by anonymous 05.09.2017 / 19:23

1 answer

0

In the latest versions of Angular, you no longer define directives in the @Component.

Now you declare your policies in your @ngModule. For example:

@NgModule({
  declarations: [
    AppComponent,
    HeaderComponent,
    ModalUtilComponent
  ]
})

Another thing, I do not know what exactly you're trying to do, but the Router is not a directive, but a service that needs to be injected into your policy, take a look here .

    
05.09.2017 / 23:08