LearnNewsExamplesServices
Frontmatter
id3172
titleFormulas in ViewModel and ViewController
stateClosed
labels
enhancementstale
assignees[]
createdAtJun 20, 2022, 11:43 AM
updatedAtSep 15, 2024, 4:35 AM
githubUrlhttps://github.com/neomjs/neo/issues/3172
authorDinkh
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtSep 15, 2024, 4:35 AM

Formulas in ViewModel and ViewController

Closed v8.1.0 enhancementstale
Dinkh
Dinkh commented on Jun 20, 2022, 11:43 AM

I would like to get an easy way of listening to changes in viewModel Data and Store-configs These should be listened to in formulas in the viewModel and viewController

@example

viewModel

data: {
    a: 1
},
stores: {
    mystore: {
        isLoading: false  // config of the current state of the store
    }
}
formulas: {
    b: {
        bind: {a: 'a'},
        get(data => toUppercase(data.a);)
    },
    storeIsLoading: {
        bind: {isLoading: 'mystore.isLoading',
        get(data) {return isLoading}
    }
}

viewController

formulas: {
    b: {
        bind: {a: 'a'},
        fn: 'onAChange'
    },
    storeIsLoading: {
        bind: {isLoading: 'mystore.isLoading',
        fn: 'onStoreLoadingChange'
    }
},

onAChange(value, oldValue) {},
onStoreLoadingChange(value, oldValue) {}
Dinkh added the enhancement label on Jun 20, 2022, 11:43 AM