Angular-cli: @Input, @Output Properties

Created on 8 Dec 2015  路  5Comments  路  Source: angular/angular-cli

I tried to add @Input, @Output Properties to a component:

@Component({selector: 'todo-cmp'})
class TodoCmp {
  @Input() model;
  @Output() complete = new EventEmitter(); // TypeScript supports initializing fields

  onCompletedButton() {
    this.complete.next(); // this fires an event
  }
}

But i get the error:
app/app1.ts (13, 4): Cannot find name 'Input'.

Most helpful comment

If you're using Angular Alpha 46, you should import the following for the code that you sent:

import {Input, Output, Component} from 'angular2/angular2';

If you update to the latest Alpha 48:

import {Component, Input, Output} from 'angular2/core';

All 5 comments

I'm able to use them testing against the current master. Which version are you using?

Can you share the module imports that you're using to gain access to @Import and @Output?

I use angular Alpha 46 and cli 0.0.15
what modules do I have to import?

If you're using Angular Alpha 46, you should import the following for the code that you sent:

import {Input, Output, Component} from 'angular2/angular2';

If you update to the latest Alpha 48:

import {Component, Input, Output} from 'angular2/core';

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

naveedahmed1 picture naveedahmed1  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

donaldallen picture donaldallen  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

sysmat picture sysmat  路  3Comments