Migrating directives from ionic2 to ionic3


#1

hi

I hv working directives in ionic2 and want to migrate them to inoic3 but hving hard time to understand how.

This is what it looks like on ionic2:

import {Component, Input,Output, EventEmitter} from '@angular/core';

@Component({
    selector: 'serviceholder',
    templateUrl: 'build/providers/lang-service/lang-service.html'
})

export class SomeService {}

in ionic 3 i tried:

import {Directive, Component, Input,Output, EventEmitter} from '@angular/core';

@Directive({ selector: '[serviceholder]'})

@Component({
    selector: 'serviceholder',
    templateUrl: 'build/providers/lang-service/lang-service.html'
})

export class SomeService {}

i added to app.module.ts:

import { SomeService } from '../providers/some-service/some-service';

@NgModule({
  declarations: [
    MyApp,
    SomeService
  ],

then in the html i hv a tag .

It was a directive that would create an ion-select menu and supposed to be able to let users to choose language settings (switching language instantly on each page)

in ionic2 there used to be an example in Git to show how this work but in ionic3 i am yet to find any…


#2

Having both Directive and Component decorators seems odd to me.