Having some issues to bind a value from a child component to a parent one, the parent has this in html:
<ion-item [ngClass]="{'primary-disabled': synced}">
<syncServ (synced)="updateSync(sync)"></syncServ>
</ion-item>
The child html:
<div (click)="syncServer()">
<i class="fa fa-refresh fa-2x"></i>
<div>
P: {{ orders }} V: {{ visits }}
</div>
</div>
And the child class:
import {Component, Output, EventEmitter} from 'angular2/core';
import {Config, DB} from '../../services/services';
@Component({ // directives: [NgIf], // properties: ['value'], //Change to be whatever properties you want, ex: <sync value="5"> selector: 'syncServ', templateUrl: 'build/components/sync/sync.html' }) export class SyncComponent { orders = 0 visits = 0
@Output() synced = new EventEmitter();
constructor( conf: Config, db: DB ) { this.conf = conf this.db = db this.synced = true; } }
The error:
EXCEPTION: TypeError: emitter.subscribe is not a function
(index):29
EXCEPTION: TypeError: emitter.subscribe is not a functionconsole.(anonymous function) @ (index):29BrowserDomAdapter.logError @ app.bundle.js:33707BrowserDomAdapter.logGroup @ app.bundle.js:33717ExceptionHandler.call @ app.bundle.js:7851(anonymous function) @ app.bundle.js:16833NgZone._notifyOnError @ app.bundle.js:17474collection_1.StringMapWrapper.merge.onError @ app.bundle.js:17369run @ app.bundle.js:1186(anonymous function) @ app.bundle.js:17387zoneBoundFn @ app.bundle.js:1156lib$es6$promise$$internal$$tryCatch @ app.bundle.js:2556lib$es6$promise$$internal$$invokeCallback @ app.bundle.js:2568lib$es6$promise$$internal$$publish @ app.bundle.js:2539(anonymous function) @ app.bundle.js:1288microtask @ app.bundle.js:17427run @ app.bundle.js:1183(anonymous function) @ app.bundle.js:17387zoneBoundFn @ app.bundle.js:1156lib$es6$promise$asap$$flush @ app.bundle.js:2350
(index):29 STACKTRACE:console.(anonymous function) @ (index):29BrowserDomAdapter.logError @ app.bundle.js:33707ExceptionHandler.call @ app.bundle.js:7853(anonymous function) @ app.bundle.js:16833NgZone._notifyOnError @ app.bundle.js:17474collection_1.StringMapWrapper.merge.onError @ app.bundle.js:17369run @ app.bundle.js:1186(anonymous function) @ app.bundle.js:17387zoneBoundFn @ app.bundle.js:1156lib$es6$promise$$internal$$tryCatch @ app.bundle.js:2556lib$es6$promise$$internal$$invokeCallback @ app.bundle.js:2568lib$es6$promise$$internal$$publish @ app.bundle.js:2539(anonymous function) @ app.bundle.js:1288microtask @ app.bundle.js:17427run @ app.bundle.js:1183(anonymous function) @ app.bundle.js:17387zoneBoundFn @ app.bundle.js:1156lib$es6$promise$asap$$flush @ app.bundle.js:2350
(index):29 TypeError: emitter.subscribe is not a function
at Function.ObservableWrapper.subscribe (app.bundle.js:15480)
at EventEmitterAccessor.subscribe (app.bundle.js:19329)
at AppViewManagerUtils.setUpEventEmitters (app.bundle.js:20628)
at AppViewManagerUtils.hydrateView (app.bundle.js:20596)
at AppViewManagerUtils.hydrateViewInContainer (app.bundle.js:20566)
at AppViewManager.createViewInContainer (app.bundle.js:20290)
at AppViewManager.createHostViewInContainer (app.bundle.js:20260)
at ViewContainerRef.createHostView (app.bundle.js:20979)
at app.bundle.js:43605
at Zone.run (app.bundle.js:1183)