简体   繁体   中英

Data binding to table with local storage data in angular

Hi i am doing simple shopping cart application using angular 8. I have place order screen there i list out some products to be order with option for quantity refer images i attached. i list out the products from json data and binded to table there i have a scenario called filling shopping items based on users previous orders. for example if user previously ordered a pencil box, or a pen, i have those quantity counts & individual price details. i need those quantity counts to be displayed by default on their place order screen. EX pencil box have 10 quantities the value must be displayed in the row of pencil box quantity textbox. i am storing the previous order details in local storage. i dont know how to retrieve and displayed to quantity textbox. can anyone help me to do this things.

in my image i have quantity count 1 for product code 1000. i need that count need to displayed in next table of that particular product quantity textbox. like wise if i have more product quantities need to display vise versa. thanks to all

check this image

you can implement function in onChanges and make your table internal component with input data in each changes you must detect that in localstorage and also you can make data service for localstorage that has subject variable and you can subscribe each changes in table component

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM