2

I am new in Angular, and have some issue..Please help. Ng-view doesn't render the template. My code:

HomeController

public ActionResult Index()
{
    var viewModel = new Model();
    return View(viewModel);
}

_Layout

<div class="container body-content" ng-view>
    @RenderBody()
</div>

ng-app is added to <html>

app-route.js

(function () {
    'use strict';
    formsWorkflowApp.config(['$routeProvider', function ($routeProvider) {
        $routeProvider
            .when("/", {
                 templateUrl: "Home/Index",
                 controller: "HomeController"
             })
             .when("/Form/SearchResults", {
                 templateUrl: "Form/SearchResults",
                 controller: "SearchController"
             })
             .otherwise({
                 redirectTo: "/"
             });
    }]);
}());

What is wrong?

2
  • It seems you are missing a few basic things by looking at your code. This article should help you get on the right track: Getting Started with MVC and Angular Commented Feb 18, 2017 at 13:56
  • change the ng-view to ui-view and used 'ui.router' insted of ngroute, More details available on here: stackoverflow.com/questions/32573403/… Commented Nov 18, 2017 at 11:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.