title: Routing in Asp.net Core using AngularJs
body: <p>I am fairly new to the Asp.Net. So anyways, what I want to achieve/do is I want to control the routing in Asp.net Core using AngularJs. But the problem is I can't load(?) the page(s) I want. The pages are not showing in the ng-view. or am i doing something wrong? Thanks in advance.</p>
  
  <p>Here some of my code:</p>
  
  <p>_Layout.cshtml:</p>
  
  <pre><code>&lt;body  ng-app="myApp" style="background-color:white"&gt;
  &lt;div ng-controller="Test"&gt;
  &lt;h1 style="margin-left:20px;color:darkred"&gt;Test&lt;/h1&gt;
  &lt;input ng-model="test"/&gt;
  &lt;p&gt;{{tester}}&lt;/p&gt;
  &lt;p style="color:black"&gt;{{test}}&lt;/p&gt;
      &lt;/div&gt;
  &lt;ul&gt;
      &lt;li&gt;&lt;a href="#routeOne"&gt;Route One&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#routeTwo"&gt;Route Two&lt;/a&gt;&lt;/li&gt;
  
  &lt;/ul&gt;
  &lt;div&gt;
      &lt;p&gt;@Model.test_name&lt;/p&gt;
      &lt;p&gt;@Model.test_role&lt;/p&gt;
  
  
  &lt;/div&gt;
  &lt;div ng-view&gt;&lt;/div&gt;
  
  &lt;div class="container body-content"&gt;
      @RenderBody()
  
  
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>HomeController.cs:</p>
  
  <pre><code>namespace WebApplication12.controllers
   {
  public class HomeController : Controller
  {
      public ActionResult Index()
      {
          MysqlConnector test = new MysqlConnector();
          return View(test);
      }
  
    }
   }
  </code></pre>
  
  <p>Index.cshtml:</p>
  
  <pre><code>@{
  ViewData["Title"] = "One";
  }
  
   &lt;p&gt; {{tester}}  test&lt;/p&gt;
  </code></pre>
  
  <p>Index1.cshtml:</p>
  
  <pre><code> @{
  
     ViewData["Title"] = "Second";
  
   }
  
   &lt;p&gt;Second&lt;/p&gt;
  </code></pre>
  
  <p>site.js:</p>
  
  <pre><code>var app = angular.module('myApp', ['ngRoute']);
  app.controller('Test', function ($scope) {
  
      $scope.tester = "message displayed";
  
  });
  
  app.config(['$routeProvider', function ($routeProvider){
    $routeProvider.
       when('/routeOne', {
          template: '&lt;p&gt;First Page&lt;/p&gt;',
          controller: "Test"
       })
      .when('/routeTwo', {
          templateUrl: 'Index1.cshtml',
          controller: "Test"
  
      })
  
   }]);
  </code></pre>
  
  <p>p.s: test_name and test_role are from mysql server they are working fine.</p>
  
  <p>p.s 2: I cut the scripts part in layout. so scripts are working/loaded correctly.</p>