Why? If the canDeactivate hook returns true, navigation is allowed; if false is returned, it is prevented and the route state is reverted. Use Git or checkout with SVN using the web URL. GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together. in the browser. See TypeScript's official documentation, if you encounter issues. Did you notice the calls to PLATFORM.moduleName(....)? Below that we have the application's main container div. We'll refer to the over-arching application structure, as the shell or layout of our app. First, take a look at the require elements at the top of the view. Now that you've got the basics down, you need to learn how to use the CLI, build a more complex app and get a solid knowledge foundation for real-world work. The first will contain our contact list, indicated by the placeholder div. This API returns a Promise which we wait on and then store the loaded contact in a contact property so it's easy to bind to. (Do not select "Custom" for this tutorial.). We've also imported the two messages we created. Classes can declare constructor dependencies through inject metadata. Aurelia actually gives you the ability to globalize view resources, such as custom elements. Each of these messages will carry the contact data along with it so that subscribers have contextual data related to the event. For more information, see our Privacy Statement. All we want to do is display a message to our end user to select a contact. Throughout the list template, we've used basic string interpolation binding to show the firstName, lastName and email of each contact. It's the view equivalent of the ES 2015 "import" syntax. When Aurelia instantiates the contact list, it will first instantiate (or locate) an instance of the web API and "inject" that into the contact list's constructor. To accomplish this, we use the select method to track the selected contact's id, which allows us to instantly apply the selection style. Update your app${context.language.fileExtension} as follows: Ok, now that we've got an api property we can bind to, update your app.html to the final version that adds the loading-indicator and binds its loading property: And with that, we've finished our app. You can use the configuration object to get the router setup with the routes you want. http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/contact-manager-tutorial - dzadnip/aurelia-contact-manager For more information, see our Privacy Statement. If you've already setup your machine with the CLI, you can skip to the next section. Learn more, We use analytics cookies to understand how you use our websites so we can make them better, e.g. This will help us show some simple feedback to the user to indicate whether the UI and data are in a state that allows for saving. The router generates a navModel for each routeConfig. Don't be intimidated by the amount of HTML above. Once the dependencies are installed (it will take a few minutes), your project is ready to go. Why would we do this if the href is already going to handle navigating to the correct contact? Open up the resources/index${context.language.fileExtension} file that's already in your solution, and change the code so that it has the registration as follows: With this registration in place, we can now use our new indicator in our app.html, but before we do that, we want to make one more change to our app${context.language.fileExtension}. Whenever you have a configureRouter method, the view must also contain a router-view.