Steps to Configure the Angular JS Project

Step 1: Create a new project

ng new local_storage_gfg

Step 2: Open the project on any IDE or Text Editor(VSCode, or Sublime Text).

Step 3: To run the project, follow the below command

ng serve --open

Step 4: Replace the pre-existing code in the src>app>app.component.html with the following code examples.

How to Store Data in Local Storage using AngularJS ?

Angular JS is a typescript-based web application framework. It is supported by the Angular team of Google and open-source developers. It is a component-based framework allowing the developers to reuse the components created. It is well-suited for large and complex applications because of its well-defined project structure, templates, etc.

Similar Reads

Local Storage

Local Storage in Angular JS allows the developers to store some data in the browser itself to access it almost instantly without any HTTP request. Local Storage in the Website allows the users to save the data in the form of key-value pairs. It does not have any expiration date or TTL (Time to Live) and it doesn’t depend on the session. If we close the browser and reopen later, the values will be saved. It is the property of the window object and hence is accessible globally without requiring any libraries or importing any package. Different browsers have different storage locations and types. For Google Chrome, it is stored in the user profile directory, where Chrome is installed in an SQLite d database. In Firefox, local storage is stored in the webappsstore.sqlite file in the profile folder. It is suitable for small amounts of storage like strings, dates, or similar. Storing files is not suitable since it would then block the process and hence slow down the activity of the browser....

Steps to Configure the Angular JS Project

Step 1: Create a new project...

Project Structure

The following project structure will be generated after completing the above steps....

Approach

In this approach, we will use the $window.localStorage functionality of the browser to save data. The methods & their description are given below:...