1
Answer

Dynamically Loading Url using ng-include is comment

AngularJS - Dynamically Loading template Url using ng-include is commenting or not displaying(by inspecting) when application is running .
How can i rectify this commenting

I have code as below:

templateController.js
======================

var app = angular.module("myApp", []);

app.controller("MyCtrl", function ($scope) {
function onChange() {
// alert("Selected Value: " + $("#Category").val() + "\nSelected Text: " + $("#Category").data("kendoDropDownList").text());
$scope.templateUrl = $("#Category").val();
return $scope.templateUrl;
};
Categorydata = [

{ CategoryId: "'http://localhost/IncludeDynamicTemplateUrl/Receipts.html'", CategoryName: "Receipts" },
{ CategoryId: "'http://localhost/IncludeDynamicTemplateUrl/Payments.html'", CategoryName: "Payments" },
{ CategoryId: "'http://localhost/IncludeDynamicTemplateUrl/Loans.html'", CategoryName: "Loans" }


];
$("#Category").kendoDropDownList({
dataTextField: "CategoryName",
dataValueField: "CategoryId",
dataSource: Categorydata,
index: 0,
change: onChange
});
});


Default.html
=============

<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title></title>
</head>
<body ng-controller="MyCtrl">
<div class="form-group">
<label for="receipts">Category Names :</label>
<div>
<select id="Category" />
</div>
</div>
<div>
<div ng-include="templateUrl"></div>
</div>
</body>
</html>
Answers (1)