/ / Kiedy użyłem ng-include do dynamicznego ładowania html, kontroler tego html nie jest ładowany - angularjs

Kiedy używałem ng-include do dynamicznego ładowania html, kontroler tego html nie jest ładowany - angularjs

Mam następujący scenariusz

assemblyHeader.js

$scope.AssemblyHeaderDetails = function () {

if {
mixpanelEventTrack("Quote Details Clicked");
var RFQDetailInstance = $modal.open({
templateUrl: "Scripts/ng/View/QuoteDetailPopup.html",
windowClass: "QuoteDetail",
controller: "QuoteDetailPopupController",
resolve: {
AssemblyId: function () { return $scope.AssemblyInfo.assemblyid; },
parentScope: function () {
return $scope;
}
}
});
RFQDetailInstance.result.then(function (result) {
});
}
}

Oto moje QuoteDetailPopup.html

<link href="Content/PageCss/requestFormView.css" rel="stylesheet" />
<div>
<div ng-include src="TemplateUrl" >
hello world!!!
</div>
</div>

Poniżej znajduje się mój kontroler dla html QuoteDetailPopupController.js

(function () {
"use strict";

var controllerId = "QuoteDetailPopupController";

angular.module("CalcQouteModule").controller(controllerId,
["$scope", "DataConstants", "$filter", "MessageConstant", "$modalInstance", "parentScope", "$modal", "urlConstant", "$timeout", QuoteDetailPopupController]);

function QuoteDetailPopupController($scope, DataConstants, $filter, MessageConstant, $modalInstance, parentScope, $modal, urlConstant, $timeout) {

$scope.TemplateUrl = "Scripts/ng/View/requestFormView.html";
}
}());

Problem polega na tym, że gdy otwiera się wyskakujące okienko modalne, renderuje stronę HTML, ale nie renderował kontrolera requestFormView.html, więc elementy sterujące w HTML nie są ładowane poprawnie. Dla requestFormView.html nazwa kontrolera to requestFormController.js Po kliknięciu otwiera się następujące wyskakujące okienko.

wprowadź opis obrazu tutaj

Jak mogę załadować kontroler?

Odpowiedzi:

0 dla odpowiedzi № 1

Dodaj plik kontrolera w index.html i app.js, gdy trafisz tam na adres URL zawierający nazwę kontrolera. Mam nadzieję, że to ci pomoże.