In file html i write
<div data-bind=" $parent.checkPaymentPage() ">...</div>
In file js i have
checkPaymentPage: function(){
console.log(1);
}
But when i call and reload it not console.log(1). How can i call it? Please help me!
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityIn file html i write
<div data-bind=" $parent.checkPaymentPage() ">...</div>
In file js i have
checkPaymentPage: function(){
console.log(1);
}
But when i call and reload it not console.log(1). How can i call it? Please help me!
in the knockout HTML you can use the data-bind with the various binding map
in order to just call the component file function, you can use data-bind with afterRender
so whenever you div was loaded this function call.
<div data-bind="afterRender: checkPaymentPage">...</div>
in the js file you can write the function.
checkPaymentPage: function(){ console.log(1); },
Ex. if you are using an observable variable
isVisible: ko.observable(false),
isLoading: ko.observable(false),
You can use the below code
<div data-bind="fadeVisible: isVisible() , blockLoader: isLoading()" id="component-container">.....</div>