Of course you can also create a provider to fire your Redux actions. Here's an example using @ReduxActionContext and @ReduxAction:
import { Injectable } from '@angular/core';
import { ReduxAction, ReduxActionContext } from '@harmowatch/ngx-redux-core';
@Injectable()
@ReduxActionContext({prefix: 'TodoActions://'})
export class TodoActions {
@ReduxAction()
add(label: string): TodoListItem {
return label; // your return value is the payload
}
}
Now @harmowatch/ngx-redux-core
will dispatch the following action, every time the add
method was called:
{
"type": "TodoActions://add",
"payload": "SampleTodo"
}