Very new to action cable and angular 2. I keep receiving this error, Subscription class not found: "MessagesChannel", when running the rails server. I am using ng2-cable to connect to my rails api.
I am using angular 2 on cordova
import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { MessageData } from '../providers/message-data';
import { Ng2Cable, Broadcaster } from 'ng2-cable/js/index';
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [ MessageData, Ng2Cable, Broadcaster ]
})
export class AppModule {
messages: any;
constructor(private ng2cable: Ng2Cable, private broadcaster: Broadcaster){
this.ng2cable.subscribe('http://localhost:3000/cable', 'MessagesChannel');
}
}
Rails MessagesChannel
class MessagesChannel < ApplicationCable::MessagesChannel
def subscribed
stream_from 'allmessages'
end
end
Any help is appreciated!