Last post Mar 02, 2015 12:54 AM by Waruna the creator
Member
1 Points
11 Posts
Mar 02, 2015 12:25 AM|Waruna the creator|LINK
My index.cshtml content is as the following..
<!DOCTYPE html>
<html ng-app="sportsstore"> <head> <title>SportsStore</title> <link href="~/Content/bootstrap.min.css" rel="stylesheet" /> <script src="~/Scripts/angular.js"></script> <script> var todoAPP = angular.module("sportsstore", ["customFilters"]); </script> <script src="~/Scripts/controllers/sportstore.js" type="text/javascript" ></script> <script src="~/Scripts/filters/customFilters.js"></script> <script src="~/Scripts/controllers/productListController.js"></script> <style> .btn-group-wrap { text-align: center; } </style> </head> <body ng-controller="sportsctrl"> <div class="navbar navbar-inverse"> <a class="navbar-brand" href="#">Sports Store</a> </div> <div class="alert alert-danger" ng-show="data.error!=null"> Error({{data.error.status}})product data was not loaded messa {{data.error.message}} <a href="~/Home/Index" class="btn btn-primary" >Click here to try again.</a> </div> <div data-ng-include="'wex'"></div> </body> </html>
Problem is this partial view is not loading.
This is my folder structure
T
What am I doing wrong here?
420 Points
118 Posts
Mar 02, 2015 12:31 AM|pka246|LINK
You cannot include cshtml page directly using ng-include.
You need to render using Controller Action method like this:
<div ng-include="'Home/Account'"></div>
Read this thread: http://stackoverflow.com/questions/20801780/angular-ng-include-cshtml-page
Mar 02, 2015 12:54 AM|Waruna the creator|LINK
You gave me the correct answer for the question to which I wasted few hours(yesterday and today). Thank you a lot Pka246.
Member
1 Points
11 Posts
How to use ng-include in MVC cshtml page?
Mar 02, 2015 12:25 AM|Waruna the creator|LINK
My index.cshtml content is as the following..
<!DOCTYPE html>
<html ng-app="sportsstore">
<head>
<title>SportsStore</title>
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
<script src="~/Scripts/angular.js"></script>
<script>
var todoAPP = angular.module("sportsstore", ["customFilters"]);
</script>
<script src="~/Scripts/controllers/sportstore.js" type="text/javascript" ></script>
<script src="~/Scripts/filters/customFilters.js"></script>
<script src="~/Scripts/controllers/productListController.js"></script>
<style>
.btn-group-wrap
{
text-align: center;
}
</style>
</head>
<body ng-controller="sportsctrl">
<div class="navbar navbar-inverse">
<a class="navbar-brand" href="#">Sports Store</a>
</div>
<div class="alert alert-danger" ng-show="data.error!=null">
Error({{data.error.status}})product data was not loaded messa {{data.error.message}}
<a href="~/Home/Index" class="btn btn-primary" >Click here to try again.</a>
</div>
<div data-ng-include="'wex'"></div>
</body>
</html>
Problem is this partial view is not loading.
This is my folder structure
T
What am I doing wrong here?
Member
420 Points
118 Posts
Re: How to use ng-include in MVC cshtml page?
Mar 02, 2015 12:31 AM|pka246|LINK
You cannot include cshtml page directly using ng-include.
You need to render using Controller Action method like this:
Read this thread: http://stackoverflow.com/questions/20801780/angular-ng-include-cshtml-page
Member
1 Points
11 Posts
Re: How to use ng-include in MVC cshtml page?
Mar 02, 2015 12:54 AM|Waruna the creator|LINK
You gave me the correct answer for the question to which I wasted few hours(yesterday and today). Thank you a lot Pka246.