나는 angularJs를 사용하고 있으며, asp.net mvc4로 트위터 부트 스트랩을 사용하고 있습니다. 나는 앵글 스트랩을 사용하지 않았습니다. 부트 스트랩 모달에서 부분 뷰를로드하려고합니다. 부분보기에는 각도 코드가 포함됩니다.앵귤러 코드가 부트 스트랩 모달에서 작동하지 않습니다.
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div ng-app="">
<label>Sample: <input type="text" ng-model="sample" /></label>
<br />
<label>Show Value: {{sample}}</label>
</div>
<div class="ContainerRowButton">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
: 여기 내 코드는 '징발'컨트롤러 '만들기'조치를
@model IEnumerable<IMS.Domain.Model.GetAllRequisitions_Result>
@{
ViewBag.Title = "Requisition List";
Layout = "~/Views/Shared/MasterPage.cshtml";
}
<a href="#myModal" role="button" class="btn btn-primary" id="modalluncher" data-toggle="modal" onclick="loadCreateForm()"> Launch demo modal </a>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-body">
</div>
</div>
<script type="text/javascript">
function loadCreateForm() {
var content = '@Url.Action("Create", "Requisition", new { area = "IMS" })';
$('div.modal-body').load(content);
}
</script>
입니다 : 여기
내가 부트 스트랩 모달를 호출하고 내 코드입니다 {{sample}}에 의해 데이터를 표시하려고 시도 할 때 ng-model = "sample"의 경우 {{sample}}을 유지합니다. 그것은 내 '창조'행동이 angularJ를 얻지 못하는 것과 같습니다.
'MasterPage.cshtml'에 필요한 모든 스크립트를 렌더링했습니다.
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Scripts.Render("~/bundles/others")
을 그리고 여기 내 'Bundle.config.cs'파일의 코드입니다 : 내 MasterPage.cshtml이 포함
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/others").Include(
"~/Content/bootstrap/js/bootstrap.js",
"~/Scripts/jquery.dataTables.js",
"~/Scripts/dataTables_bootstrap.js",
"~/Scripts/bootstrap-dropdown.js",
"~/Scripts/jquery.dataTables.columnFilter.js",
"~/Scripts/Custom/CustomScript.js",
"~/Scripts/jquery.validationEngine-en.js",
"~/Scripts/jquery.validationEngine.js",
"~/Scripts/angular.js"
));
내가 뭐하는 거지 무슨 문제 ? 도움이 필요합니다 ...
'loadCreateForm()'의 기능은 무엇입니까? 부분적으로 아약스 호출을로드하고 있습니까? –
페이지로드가 완료되고 모달 html이 $ scope에 바인드되지 않은 후에 모달 HTML을 주입하고 있습니다. 이 작업을하기 위해'$ compile (html) ($ scope)'로 html을 컴파일해야한다. – Muctadir