I am creating an ASP.net MVC application.
I am loading a partial view in a div using jQuery and AngularJS as following:
I am doing an ajax call using AngularJS and storing the result as the content in div "courseList" using jQuery. This happens when the user clicks on links.
angular.module('Domain', []).controller('DomainCtrl', function ( $http, $scope, $window) { $scope.GetCourseList = function (domain) { $http({ method: 'GET', url: '/Showcase/CourseList', params: { domain: domain } }).then(function (obj) { $('#courseList').html(obj.data); //jQuery code to load the content }); }; });
Html:
<nav ng-app="Domain"> <h2>Domains</h2> <ul ng-controller="DomainCtrl" ng-init="domain=''"> @foreach (var item in (List<string>)ViewBag.domains) { <li><a href="#" ng-click="GetCourseList('@item.ToString()')">@item.ToString() </a></li> } </ul> </nav> <div id="courseList"> </div>
The above code works fine. But I am using jQuery to populate the <div ID="courseList">
.
How can I achieve this with AngularJS and no jQuery?
<div><table>...
this will be inserted into the divcourseList