{"id":1701,"date":"2018-03-05T07:27:28","date_gmt":"2018-03-05T05:27:28","guid":{"rendered":"https:\/\/code-maze.com\/?p=1701"},"modified":"2025-01-26T08:47:05","modified_gmt":"2025-01-26T07:47:05","slug":"net-core-web-development-part8","status":"publish","type":"post","link":"https:\/\/code-maze.com\/net-core-web-development-part8\/","title":{"rendered":"Angular Navigation and Routing"},"content":{"rendered":"<p>One of every web application&#8217;s main features is navigation, and to enable it in our project, we need to use routing. The Angular Router enables navigation from one view to the next as users perform application tasks.<\/p>\n<p>In our navigation menu, we are going to have three menu options: one for the home screen, another one for the owner operations, and the last one for the account operations. Hopefully, this will help you realize the advantages of using multiple modules inside a project and how the lazy content loading helps our application perform better.<\/p>\n<p>For the complete navigation and all the basic instructions of the Angular series, check out: <a href=\"https:\/\/code-maze.com\/angular-series\/\" target=\"_blank\" rel=\"noopener noreferrer\">Introduction of the Angular series.<\/a><\/p>\n<p>So, let&#8217;s start.<\/p>\n<h2><a id=\"creatingNavigation\"><\/a>Create a Navigation Menu<\/h2>\n<p>So, let&#8217;s start by creating a new Menu component:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">ng g component menu --skip-tests<\/code><\/p>\n<p>We are going to use Bootstrap classes to implement the navigation menu within the <code>menu.component.html<\/code> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;div class=\"row\"&gt;\r\n  &lt;div class=\"col\"&gt;\r\n    &lt;nav class=\"navbar navbar-expand-lg navbar-dark bg-dark\"&gt;\r\n      &lt;div class=\"container-fluid\"&gt;\r\n        &lt;a class=\"navbar-brand\" href=\"#\"&gt;Account-Owner Home&lt;\/a&gt;\r\n        &lt;button class=\"navbar-toggler\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#collapseNav\"\r\n          aria-controls=\"collapseNav\" aria-expanded=\"false\" aria-label=\"Toggle navigation\"&gt;\r\n          &lt;span class=\"navbar-toggler-icon\"&gt;&lt;\/span&gt;\r\n        &lt;\/button&gt;\r\n\r\n        &lt;div class=\"collapse navbar-collapse\" id=\"collapseNav\"&gt;\r\n          &lt;ul class=\"navbar-nav me-auto mb-2 mb-lg-0\"&gt;\r\n            &lt;li class=\"nav-item\"&gt;\r\n              &lt;a class=\"nav-link\" href=\"#\"&gt;Owner Actions &lt;\/a&gt;\r\n            &lt;\/li&gt;\r\n            &lt;li class=\"nav-item\"&gt;\r\n              &lt;a class=\"nav-link\" href=\"#\"&gt;Account Actions &lt;\/a&gt;\r\n            &lt;\/li&gt;\r\n          &lt;\/ul&gt;\r\n        &lt;\/div&gt;\r\n      &lt;\/div&gt;\r\n    &lt;\/nav&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>Currently, we are not going to modify the <code>menu.component.ts<\/code> file.<\/p>\n<p>But, we are going to change our <code>app.component.html<\/code> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;div class=\"container\"&gt;\r\n  &lt;div class=\"row\"&gt;\r\n    &lt;div class=\"col\"&gt;\r\n      &lt;app-menu&gt;&lt;\/app-menu&gt;\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div class=\"row\"&gt;\r\n    &lt;div class=\"col\"&gt;\r\n      &lt;app-home&gt;&lt;\/app-home&gt;\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>Now, we can start our angular project by typing with <code>ng serve -o<\/code>.<\/p>\n<p>As soon as the project runs, we are going to see our menu on the screen:<\/p>\n<p><a href=\"https:\/\/code-maze.com\/wp-content\/uploads\/2022\/04\/02-Navigation-menu.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-69375\" src=\"https:\/\/code-maze.com\/wp-content\/uploads\/2022\/04\/02-Navigation-menu.png\" alt=\"Angular Navigation menu\" width=\"936\" height=\"135\" srcset=\"https:\/\/code-maze.com\/wp-content\/uploads\/2022\/04\/02-Navigation-menu.png 936w, https:\/\/code-maze.com\/wp-content\/uploads\/2022\/04\/02-Navigation-menu-300x43.png 300w, https:\/\/code-maze.com\/wp-content\/uploads\/2022\/04\/02-Navigation-menu-768x111.png 768w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/a><\/p>\n<p>There it is.\u00a0<\/p>\n<h2>Add Collapse Functionality to the NavBar<\/h2>\n<p>Right now, if we shrink our screen, we will be able to see the hamburger button, which once we click on it, should show our menu items. But it doesn&#8217;t because we didn&#8217;t install all the JavaScript parts for Bootstrap. And we don&#8217;t want to.<\/p>\n<p>What we want is to use ngx-bootstrap as much as we can with all the components it provides for us.\u00a0<\/p>\n<p>That said, we are going to use the Collapse component from ngx-bootstrap to enable our collapsable menu.<\/p>\n<p>So, let&#8217;s first import the component into the <code>app.module<\/code> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-highlight=\"1,15\">import { CollapseModule } from 'ngx-bootstrap\/collapse';\r\n\r\n...\r\n\r\n@NgModule({\r\n  declarations: [\r\n    AppComponent,\r\n    HomeComponent,\r\n    MenuComponent\r\n  ],\r\n  imports: [\r\n    BrowserModule,\r\n    AppRoutingModule,\r\n    BrowserAnimationsModule,\r\n    CollapseModule.forRoot()\r\n  ],<\/pre>\n<p>In this file, we can also notice a <code>MenuComponent<\/code> inside the <code>declarations<\/code> array. It was imported earlier during the creation of the navigation component.<\/p>\n<p>Then, we are going to add one property inside the <code>menu.component.ts<\/code> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-highlight=\"2\">export class MenuComponent implements OnInit {\r\n  isCollapsed: boolean = false;\r\n  \r\n  constructor() { }\r\n\r\n  ngOnInit(): void {\r\n  }\r\n\r\n}<\/pre>\n<p>And finally, we are going to modify our NavBar HTML code:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-highlight=\"6-7,11\">&lt;div class=\"row\"&gt;\r\n  &lt;div class=\"col\"&gt;\r\n    &lt;nav class=\"navbar navbar-expand-lg navbar-dark bg-dark\"&gt;\r\n      &lt;div class=\"container-fluid\"&gt;\r\n        &lt;a class=\"navbar-brand\" href=\"#\"&gt;Account-Owner Home&lt;\/a&gt;\r\n        &lt;button class=\"navbar-toggler\" type=\"button\" (click)=\"isCollapsed = !isCollapsed\"\r\n          [attr.aria-expanded]=\"!isCollapsed\" aria-controls=\"collapseNav\"&gt;\r\n          &lt;span class=\"navbar-toggler-icon\"&gt;&lt;\/span&gt;\r\n        &lt;\/button&gt;\r\n\r\n        &lt;div class=\"collapse navbar-collapse\" id=\"collapseNav\" [collapse]=\"!isCollapsed\" [isAnimated]=\"true\"&gt;\r\n          &lt;ul class=\"navbar-nav me-auto mb-2 mb-lg-0\"&gt;\r\n            &lt;li class=\"nav-item\"&gt;\r\n              &lt;a class=\"nav-link\" href=\"#\"&gt;Owner Actions &lt;\/a&gt;\r\n            &lt;\/li&gt;\r\n            &lt;li class=\"nav-item\"&gt;\r\n              &lt;a class=\"nav-link\" href=\"#\"&gt;Account Actions &lt;\/a&gt;\r\n            &lt;\/li&gt;\r\n          &lt;\/ul&gt;\r\n        &lt;\/div&gt;\r\n      &lt;\/div&gt;\r\n    &lt;\/nav&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>Here we add the <code>(click)<\/code> event, which will change the <code>isCollapsed<\/code> property state each time we click the hamburger button. Also, pay attention that the <code>aria-controls<\/code> attribute must have the same id value as our div below it. Additionally, in the mentioned div, we set the value for the<code> [collapse]<\/code> selector to indicate the visibility of our content and set the animation to true by using the [isAnimated] input.<\/p>\n<p>That is all. Now we can shrink the screen and once the hamburger button appears, we can click on it and see our menu items.<\/p>\n<h2><a id=\"configuringRouting\"><\/a>Configure Angular Routing<\/h2>\n<p>To enable navigation between all the pages inside this project, we need to configure the Angular routing. The routing module is already created for us since we asked for it during the project creation.<\/p>\n<p>We can see that in the <code>app.module.ts<\/code> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-highlight=\"1,7\">import { AppRoutingModule } from '.\/app-routing.module';\r\n\r\n...\r\n\r\nimports: [\r\n    BrowserModule,\r\n    AppRoutingModule,\r\n    BrowserAnimationsModule,\r\n    CollapseModule.forRoot()\r\n  ],<\/pre>\n<p>The <code>AppRoutingModlue<\/code> is the module responsible for the Angular routing.<\/p>\n<p>Now, all we have to do is to modify the <code>app-routing.module.ts<\/code> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-highlight=\"1,7-8\">import { HomeComponent } from '.\/home\/home.component';\r\n\r\nimport { NgModule } from '@angular\/core';\r\nimport { RouterModule, Routes } from '@angular\/router';\r\n\r\nconst routes: Routes = [\r\n  { path: 'home', component: HomeComponent }, \r\n  { path: '', redirectTo: '\/home', pathMatch: 'full' }\r\n];\r\n\r\n@NgModule({\r\n  imports: [RouterModule.forRoot(routes)],\r\n  exports: [RouterModule]\r\n})\r\nexport class AppRoutingModule { }<\/pre>\n<p>So, we add two routes inside the <code>routes<\/code> array. This <code>routes<\/code> array is already provided inside the <code>RouterModule.forRoot<\/code> function to define routes for our application.<\/p>\n<p>When we create more than one module inside the application, we can use the <code>forRoot()<\/code> function provided by the <code>RouterModule<\/code>, only in the main(root) module.\u00a0In all other modules, we must use the <code>forChild()<\/code> function.<span style=\"color: #ff6600;\">\u00a0<\/span>The <code>forRoot()<\/code> function accepts an array of objects as a parameter. Every element of that array consists of the path and the target component for that path. So, the path: <code>home<\/code> means that on the <code>http:\/\/localhost:4200\/home<\/code> address, we are going to serve the <code>HomeComponent<\/code>. The other line inside the <code>routes<\/code> array is the default redirection to the home page.<\/p>\n<p>Now, to enable content from the routes, we have to modify the <code>app.component.html<\/code>:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;div class=\"container\"&gt;\r\n  &lt;div class=\"row\"&gt;\r\n    &lt;div class=\"col\"&gt;\r\n      &lt;app-menu&gt;&lt;\/app-menu&gt;\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div class=\"row\"&gt;\r\n    &lt;div class=\"col\"&gt;\r\n      &lt;router-outlet&gt;&lt;\/router-outlet&gt;\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>The <strong>router-outlet<\/strong> is a container for the routing content. So basically, all the content that exists on the address we are routing to is going to be presented inside that container.<\/p>\n<p>Now if we navigate to the <code>localhost:4200<\/code> we should be able to see the same result as before, but this time, we are providing our home component through the <code>&lt;router-outlet&gt;<\/code> and not <code>&lt;app-home&gt;<\/code> selector.\u00a0<\/p>\n<p>Additionally, if we click on any other menu item, we will be automatically redirected to the home page.<\/p>\n<h2><a id=\"stylingLinks\"><\/a>Styling Links<\/h2>\n<p>If we want to style your active link in the menu, we have to change our &lt;a&gt; tag:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;a class=\"navbar-brand\" [routerLink]=\"['\/home']\" routerLinkActive=\"active\" \r\n          [routerLinkActiveOptions]=\"{exact: true}\"&gt;Account-Owner Home&lt;\/a&gt;<\/pre>\n<p>With the <code>routerLinkActive<\/code><strong>,<\/strong> we are setting up the CSS class name we want to use to style the active link. Furthermore, the <code>routerLinkActiveOptions<\/code> is going to allow us to add a class only if there is an exact match of the link and the URL. Lastly, we are not using the <code>href<\/code> attribute anymore for navigation. Instead, we are using the <code>[routerLink]<\/code> directive to navigate to our routing path.<\/p>\n<p>Now in the <code>menu.component.css<\/code> file, we are going to add the <code>.active<\/code> class:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"scss\">.active{ \r\n  font-weight: bold; \r\n  font-style: italic; \r\n  color: #fff; \r\n}<\/pre>\n<p>Excellent. If we inspect our application, we are going to see that the <code>Account-Owner Home<\/code> link is now white and bold.<\/p>\n<h2><a id=\"notFound\"><\/a>Create the Not-Found Component<\/h2>\n<p>We have working navigation.<\/p>\n<p>To complete the Angular routing part of this post, we are going to create a component with the name <code>not-found<\/code>. The application is going to redirect a user to this component when they type a none existing route in the URL.<\/p>\n<p>To do that, let&#8217;s execute the familiar command:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">ng g component error-pages\/not-found --skip-tests<\/code><\/p>\n<p>This is the folder structure:<\/p>\n<p><a href=\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/05\/03-not-found-folder-structure.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-52360 size-full\" src=\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/05\/03-not-found-folder-structure.png\" alt=\"not-found folder structure Angular routing\" width=\"225\" height=\"154\" \/><\/a><\/p>\n<p>Let&#8217;s modify the <code>not-found.component.ts<\/code> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">import { Component, OnInit } from '@angular\/core';\r\n\r\n@Component({\r\n  selector: 'app-not-found',\r\n  templateUrl: '.\/not-found.component.html',\r\n  styleUrls: ['.\/not-found.component.css']\r\n})\r\nexport class NotFoundComponent implements OnInit {\r\n  notFoundText: string = `404 SORRY COULDN'T FIND IT!!!`;\r\n\r\n  constructor() { }\r\n\r\n  ngOnInit(): void {\r\n  }\r\n\r\n}<\/pre>\n<p>We have to pay attention to the string value of the <code>notFoundText<\/code> property. We are not using apostrophes but backticks (`). All the content inside the backticks will be considered as a string, even the apostrophe sign in the string.<\/p>\n<p>To continue, let&#8217;s modify the <code>not-found.component.html<\/code> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;p&gt;\r\n  {{notFoundText}}\r\n&lt;\/p&gt;<\/pre>\n<p>Also, we need to modify <code>not-found.component.css<\/code> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"scss\">p {\r\n  font-weight: bold;\r\n  font-size: 50px;\r\n  text-align: center;\r\n  color: #f10b0b;\r\n}<\/pre>\n<p>Finally, we are going to change the content inside the <code>routes<\/code> array:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-highlight=\"3,5\">const routes: Routes = [\r\n  { path: 'home', component: HomeComponent },\r\n  { path: '404', component: NotFoundComponent }, \r\n  { path: '', redirectTo: '\/home', pathMatch: 'full' },\r\n  { path: '**', redirectTo: '\/404', pathMatch: 'full' }\r\n];<\/pre>\n<p>There are two changes here. With the first change, we declare the <code>404<\/code> path and assign the <code>NotFoundComponent<\/code>component to that path. Now our component is going to be visible on the <code>localhost:4200\/404<\/code>. The second change means that whenever we search for any route that doesn\u2019t match any of our defined routes, the application redirects us to the 404 page.<\/p>\n<p>Typing\u00a0<code>localhost:4200\/whatever<\/code><span style=\"color: #ff6600;\">\u00a0<\/span>should return the not found page. Also, we may try to navigate to localhost:4200\/404, and the app will navigate us to the same page.<\/p>\n<h2><a id=\"conclusion\"><\/a>Conclusion<\/h2>\n<p>As you might have noticed, creating the menu and using the routing in the angular project is pretty straightforward. Although we are not creating a large project, it is quite big enough to demonstrate\u00a0the usage, configuration, and routing of all the pages we currently have. Of course, we are going to create routes for all new pages that we introduce to our project.<\/p>\n<p>In the <a href=\"https:\/\/code-maze.com\/net-core-web-development-part9\/\" target=\"_blank\" rel=\"noopener noreferrer\">next part of the series<\/a>, we are going to show you how to fetch the data and consume the API with HTTP and Observables.<\/p>\n<!-- Shortcode [subscribe] does not exist -->\n","protected":false},"excerpt":{"rendered":"<p>One of every web application&#8217;s main features is navigation, and to enable it in our project, we need to use routing. The Angular Router enables navigation from one view to the next as users perform application tasks. In our navigation menu, we are going to have three menu options: one for the home screen, another [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":54313,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[168],"tags":[10,22,23,61,29,28,9,32,26,52,53,62,63,40,60,45],"class_list":["post-1701","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular","tag-net","tag-net-core","tag-angular","tag-angular-components","tag-angular2","tag-angular4","tag-api","tag-deployment","tag-development","tag-entity-framework","tag-entity-framework-core","tag-modules","tag-routing","tag-visual-studio-2017","tag-visual-studio-code","tag-web-development","et-has-post-format-content","et_post_format-et-post-format-standard"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Angular - Navigation and Angular Routing - Code Maze<\/title>\n<meta name=\"description\" content=\"Find out how to create a navigation menu by using Bootstrap classes and how to use the Angular routing inside the project.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/code-maze.com\/net-core-web-development-part8\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Angular - Navigation and Angular Routing - Code Maze\" \/>\n<meta property=\"og:description\" content=\"Find out how to create a navigation menu by using Bootstrap classes and how to use the Angular routing inside the project.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/code-maze.com\/net-core-web-development-part8\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Maze\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-05T05:27:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-26T07:47:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/code-maze.com\/wp-content\/uploads\/2018\/03\/navigation-routing-angular.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1100\" \/>\n\t<meta property=\"og:image:height\" content=\"620\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Marinko Spasojevi\u0107\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/CodeMazeBlog\" \/>\n<meta name=\"twitter:site\" content=\"@CodeMazeBlog\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Marinko Spasojevi\u0107\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/\"},\"author\":{\"name\":\"Marinko Spasojevi\u0107\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/d6fa06e66820968d19b39fb63cff2533\"},\"headline\":\"Angular Navigation and Routing\",\"datePublished\":\"2018-03-05T05:27:28+00:00\",\"dateModified\":\"2025-01-26T07:47:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/\"},\"wordCount\":1123,\"commentCount\":14,\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2018\/03\/navigation-routing-angular.png\",\"keywords\":[\".NET\",\".NET CORE\",\"Angular\",\"Angular components\",\"angular2\",\"angular4\",\"API\",\"deployment\",\"development\",\"entity framework\",\"entity framework core\",\"modules\",\"routing\",\"Visual Studio 2017\",\"Visual Studio code\",\"web development\"],\"articleSection\":[\"Angular\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/code-maze.com\/net-core-web-development-part8\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/\",\"url\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/\",\"name\":\"Angular - Navigation and Angular Routing - Code Maze\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2018\/03\/navigation-routing-angular.png\",\"datePublished\":\"2018-03-05T05:27:28+00:00\",\"dateModified\":\"2025-01-26T07:47:05+00:00\",\"description\":\"Find out how to create a navigation menu by using Bootstrap classes and how to use the Angular routing inside the project.\",\"breadcrumb\":{\"@id\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/code-maze.com\/net-core-web-development-part8\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/#primaryimage\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2018\/03\/navigation-routing-angular.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2018\/03\/navigation-routing-angular.png\",\"width\":1100,\"height\":620,\"caption\":\"navigation routing angular\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/code-maze.com\/net-core-web-development-part8\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/code-maze.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Angular Navigation and Routing\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/code-maze.com\/#website\",\"url\":\"https:\/\/code-maze.com\/\",\"name\":\"Code Maze\",\"description\":\"Learn. Code. Succeed.\",\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/code-maze.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/code-maze.com\/#organization\",\"name\":\"Code Maze\",\"url\":\"https:\/\/code-maze.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"width\":3511,\"height\":3510,\"caption\":\"Code Maze\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/CodeMazeBlog\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/d6fa06e66820968d19b39fb63cff2533\",\"name\":\"Marinko Spasojevi\u0107\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/marinko-1x1-3-150x150.jpg\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/marinko-1x1-3-150x150.jpg\",\"caption\":\"Marinko Spasojevi\u0107\"},\"description\":\"Hi, my name is Marinko Spasojevic. Currently, I work as a full-time .NET developer and my passion is web application development. Just getting something to work is not enough for me. To make it just how I like it, it must be readable, reusable, and easy to maintain. Prior to being an author on the CodeMaze blog, I had been working as a professor of Computer Science for several years. So, sharing knowledge while working as a full-time developer comes naturally to me.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/marinko-spasojevic\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/CodeMazeBlog\"],\"url\":\"https:\/\/code-maze.com\/author\/marinko\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Angular - Navigation and Angular Routing - Code Maze","description":"Find out how to create a navigation menu by using Bootstrap classes and how to use the Angular routing inside the project.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/code-maze.com\/net-core-web-development-part8\/","og_locale":"en_US","og_type":"article","og_title":"Angular - Navigation and Angular Routing - Code Maze","og_description":"Find out how to create a navigation menu by using Bootstrap classes and how to use the Angular routing inside the project.","og_url":"https:\/\/code-maze.com\/net-core-web-development-part8\/","og_site_name":"Code Maze","article_published_time":"2018-03-05T05:27:28+00:00","article_modified_time":"2025-01-26T07:47:05+00:00","og_image":[{"width":1100,"height":620,"url":"https:\/\/code-maze.com\/wp-content\/uploads\/2018\/03\/navigation-routing-angular.png","type":"image\/png"}],"author":"Marinko Spasojevi\u0107","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/CodeMazeBlog","twitter_site":"@CodeMazeBlog","twitter_misc":{"Written by":"Marinko Spasojevi\u0107","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/code-maze.com\/net-core-web-development-part8\/#article","isPartOf":{"@id":"https:\/\/code-maze.com\/net-core-web-development-part8\/"},"author":{"name":"Marinko Spasojevi\u0107","@id":"https:\/\/code-maze.com\/#\/schema\/person\/d6fa06e66820968d19b39fb63cff2533"},"headline":"Angular Navigation and Routing","datePublished":"2018-03-05T05:27:28+00:00","dateModified":"2025-01-26T07:47:05+00:00","mainEntityOfPage":{"@id":"https:\/\/code-maze.com\/net-core-web-development-part8\/"},"wordCount":1123,"commentCount":14,"publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"image":{"@id":"https:\/\/code-maze.com\/net-core-web-development-part8\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2018\/03\/navigation-routing-angular.png","keywords":[".NET",".NET CORE","Angular","Angular components","angular2","angular4","API","deployment","development","entity framework","entity framework core","modules","routing","Visual Studio 2017","Visual Studio code","web development"],"articleSection":["Angular"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/code-maze.com\/net-core-web-development-part8\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/code-maze.com\/net-core-web-development-part8\/","url":"https:\/\/code-maze.com\/net-core-web-development-part8\/","name":"Angular - Navigation and Angular Routing - Code Maze","isPartOf":{"@id":"https:\/\/code-maze.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/code-maze.com\/net-core-web-development-part8\/#primaryimage"},"image":{"@id":"https:\/\/code-maze.com\/net-core-web-development-part8\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2018\/03\/navigation-routing-angular.png","datePublished":"2018-03-05T05:27:28+00:00","dateModified":"2025-01-26T07:47:05+00:00","description":"Find out how to create a navigation menu by using Bootstrap classes and how to use the Angular routing inside the project.","breadcrumb":{"@id":"https:\/\/code-maze.com\/net-core-web-development-part8\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/code-maze.com\/net-core-web-development-part8\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/net-core-web-development-part8\/#primaryimage","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2018\/03\/navigation-routing-angular.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2018\/03\/navigation-routing-angular.png","width":1100,"height":620,"caption":"navigation routing angular"},{"@type":"BreadcrumbList","@id":"https:\/\/code-maze.com\/net-core-web-development-part8\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/code-maze.com\/"},{"@type":"ListItem","position":2,"name":"Angular Navigation and Routing"}]},{"@type":"WebSite","@id":"https:\/\/code-maze.com\/#website","url":"https:\/\/code-maze.com\/","name":"Code Maze","description":"Learn. Code. Succeed.","publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/code-maze.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/code-maze.com\/#organization","name":"Code Maze","url":"https:\/\/code-maze.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","width":3511,"height":3510,"caption":"Code Maze"},"image":{"@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/CodeMazeBlog"]},{"@type":"Person","@id":"https:\/\/code-maze.com\/#\/schema\/person\/d6fa06e66820968d19b39fb63cff2533","name":"Marinko Spasojevi\u0107","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/person\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/marinko-1x1-3-150x150.jpg","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/marinko-1x1-3-150x150.jpg","caption":"Marinko Spasojevi\u0107"},"description":"Hi, my name is Marinko Spasojevic. Currently, I work as a full-time .NET developer and my passion is web application development. Just getting something to work is not enough for me. To make it just how I like it, it must be readable, reusable, and easy to maintain. Prior to being an author on the CodeMaze blog, I had been working as a professor of Computer Science for several years. So, sharing knowledge while working as a full-time developer comes naturally to me.","sameAs":["https:\/\/www.linkedin.com\/in\/marinko-spasojevic\/","https:\/\/x.com\/https:\/\/twitter.com\/CodeMazeBlog"],"url":"https:\/\/code-maze.com\/author\/marinko\/"}]}},"_links":{"self":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/1701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/comments?post=1701"}],"version-history":[{"count":4,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/1701\/revisions"}],"predecessor-version":[{"id":123791,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/1701\/revisions\/123791"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media\/54313"}],"wp:attachment":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media?parent=1701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/categories?post=1701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/tags?post=1701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}