How to use use platform api in ionic 2


Hello there,
I keep on getting an syntax error (unexpected token) at (platform: Platform) when i build my ionic 2 app but according to the documentation here i’m using it correctly can anyone please help with this.


So there’s a small syntax error here. Basically our docs use TS for their examples, but you’re using es6. ES6 does not support the syntax for constructor(platform: Platform) So instead you can do:

import {Page, Platform} from 'ionic-angular';
export class DetailPage {
  static get parameters() {
    return [[Platform]];
  constructor(platform) {
    this.platform = platform;


@mhartington Thanks so much for pointing that out, I changed my project to typescript instead of ES6. everything works fine now.