Error on constructor parameter

Good morning,

I have created a new page and I have added this code, but when I compile it , ionic gives me an error on constructor parameter.

What is the problem ?

The script file is .js:

import {Component} from '@angular/core';
import {Platform} from 'ionic-angular'

@Component({
  templateUrl: 'build/pages/search/search.html',
})
export class SearchPage {
  static get parameters() {
    return [[Platform]];
  }

  constructor(platform: Platform) {   <---- Error
    this.platform = platform;
  }
}

thanks in advance for your help.

If your file is JavaScript and not TypeScript then it should be:

constructor(platform) {

Good morning,

thank you for your help. I’ve added NavController and if I print it with console.log(), the value is “undefined”… why ?

import {Component} from '@angular/core';
import {Platform,NavController} from 'ionic-angular'

@Component({
  templateUrl: 'build/pages/search/search.html',
})
export class SearchPage {
  static get parameters() {
    return [[Platform, NavController]];
  }

  constructor(platform, navController) {
    this.platform = platform;
    console.log(this.platform.is('ios'));
    console.log(navController);
  }
}
static get parameters() {
    return [[Platform, NavController]];
}

should be:

static get parameters() {
    return [[Platform], [NavController]];
}

Good morning,

Really thank you very much!

if typeScript could set an example to inject Platform and NavController together.