मैं एक इनलाइन दृश्य टेम्पलेट लोड करना चाहता था।
मैंने टेम्पलेट को एक प्रकार के स्क्रिप्ट टैग में लपेटा text/ng-templateऔर आईडी को सेट किया temp1.html। और यहाँ मेरा मॉड्यूल कॉन्फिग कैसा दिखता है
learningApp.config(function ($routeProvider) {
$routeProvider
.when("/first",{ controller: "SimpleController", templateUrl: "temp1.html"})
.when("/second", {controller: "SimpleController", templateUrl: "temp2.html"})
.otherwise({redirectTo : "/first"});
});
यह मुझे GET http://localhost:41685/temp1.html 404 (Not Found)मेरे कंसोल विंडो में बताता है जिसका अर्थ है कि यह उस नाम की फ़ाइल की तलाश में है।
मेरा प्रश्न है: मैं इनलाइन टेम्प्लेट का उपयोग करने के लिए अपने मार्गों को कैसे कॉन्फ़िगर करूं?
अपडेट: यहां मेरा सर्वर-रेंडर DOM जैसा दिखता है
<!DOCTYPE html>
<html>
<head>
<script src="/Scripts/angular.js"></script>
<link href="/Content/bootstrap.css" rel="stylesheet"/>
</head>
<body>
<div class="container">
<h2>Getting Started with Angular</h2>
<div class="row">
<div class="panel" ng-app="LearningApp">
<div ng-view></div>
</div>
</div>
<script type="text/ng-template" id="temp1.html">
<div class="view">
<h2>First View</h2>
<p>
Search:<input type="text" ng-model="filterText" />
</p>
<ul class="nav nav-pills">
<li ng-repeat="cust in customers | orderBy:'name' | filter: filterText "><a href="#">{{cust.name}} - {{cust.school}}</a></li>
</ul>
</div>
</script>
<script type="text/ng-template" id="temp2.html">
<div class="view">
<h2>Second View</h2>
<p>
Search:<input type="text" ng-model="filterText" />
</p>
<ul class="nav nav-pills">
<li ng-repeat="cust in customers | orderBy:'name' | filter: filterText "><a href= "#">{{cust.name}} - {{cust.school}}</a></li>
</ul>
</div>
</script>
</div>
<script src="/Scripts/jquery-1.9.1.js"></script>
<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/app/LearningApp.js"></script>
</body>
</html>