From the course: Angular: Building an Interface

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Lifecycle events when importing data

Lifecycle events when importing data - Angular Tutorial

From the course: Angular: Building an Interface

Start my 1-month free trial

Lifecycle events when importing data

- [Instructor] Most interfaces rely on some type of data, so for this course we store these in a file, and we'll need to add this file into our assets folder. Remember, this assets folder contains anything that we want the application to have access to later on, like images, and in this case, we're going to add a file here. We'll call it data.json, and we're going to paste some data in there from a gist that I've created for you at this URL. I'm going to click on this Raw button right here just to make it a little bit easier to copy, and then select everything in here, copy, switch back over to my app, and then paste that right here and we'll save it. So now we have a file that we want access to. In order to do that you normally do a Ajax request in JavaScript, or perhaps use the Fetch API to get that data into the app. Now the equivalent in Angular is called observables. That's actually an ES7, or JavaScript Seven feature that lets the application keep track, or observe a file and…

Contents