We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
So in mobx you can wrap anythin in an action wrapper , since actions are needed to modify state. I have the following code
<input [(ngModel)]="mystore.foo>
<input [(ngModel)]="mystore.foo
since its a two way binding in strict mode it complains
what I am wondering is could you add a feature so that i could do this.
<input [(ngModel)]="action(() => myStore.foo)
I'm aware of the workaround to this. `<input [ngModel]="myStore.foo" (ngModelChange)="setMyStore($event)">/input>
setMyStore(val:string){ this.myStore.setFoo(val) //action for setting }
Is there a feature to be able to do an in-template action wrapper
The text was updated successfully, but these errors were encountered:
So I found another solution to this problem but its not ideal
Instead of splitting the the [(ngModel)] binding into [ngModel] (ngModelChange)
[(ngModel)]
[ngModel] (ngModelChange)
I did this
export class MyStore implements OnInit { constructor() { makeAutoObservable(this) } private _foo: string = '' get foo (): string { return this._searchText } set foo(text: string) { this._foo = text } }
<input [(ngModel)]="mystore.foo">
This seems to automatically make the set foo into an @action. I'm guessing the get foo is turned into a @computed
set foo
get foo
still being able to wrap the variable in an action in the template would be a simpler solution
Sorry, something went wrong.
No branches or pull requests
So in mobx you can wrap anythin in an action wrapper , since actions are needed to modify state.
I have the following code
<input [(ngModel)]="mystore.foo
>since its a two way binding in strict mode it complains
what I am wondering is could you add a feature so that i could do this.
<input [(ngModel)]="action(() => myStore.foo)
I'm aware of the workaround to this.
`<input [ngModel]="myStore.foo" (ngModelChange)="setMyStore($event)">/input>
setMyStore(val:string){
this.myStore.setFoo(val) //action for setting
}
Is there a feature to be able to do an in-template action wrapper
The text was updated successfully, but these errors were encountered: