Syntax error in all example codes


#1

Hi,

I want to use ionic2 example codes but this usage gives an syntax error:

import {ElementRef, Directive} from 'angular2/core';

@Directive({
    selector: '[elastic]'
})
export class Elastic{
    header: any;
    scrollerHandle: any;
    constructor(**el: ElementRef**){
        this.el = el;
        this.header = document.getElementById('elastic')
    }
    ngAfterViewInit(){
        this.scrollerHandle = this.el.nativeElement.children[0];
       this.scrollerHandle.addEventListener('scroll', function(event){
    })
    
 }
}

this code part (sign with bold) always got error.

My system information:

Cordova CLI: 6.0.0
Ionic Framework Version: 2.0.0-beta.6
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
OS: Windows 8.1
Node Version: v5.6.0


#2

import {ElementRef, Directive} from ‘@angular/core’;


#3

I’m going to guess that you’re pasting TypeScript code into a JavaScript project.