Javascript angular在使用ajax渲染实体后不起作用

Javascript angular在使用ajax渲染实体后不起作用,javascript,html,angularjs,Javascript,Html,Angularjs,我已经使用ajax呈现了一个html页面。这是我的html <div class="contents" id="subContents" ng-app=""> @RenderBody() @RenderSection("scripts", required: false) </div> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"&

我已经使用ajax呈现了一个html页面。这是我的html

<div class="contents" id="subContents" ng-app="">
    @RenderBody()
    @RenderSection("scripts", required: false)
</div>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

在渲染视图中,我尝试使用角度函数。但是在使用ajax渲染body之后,它就不能工作了。

为什么要使用ajax渲染站点?可以将布线扩展插件用于角度。用户界面路由器或角度路由器。最好在没有jQuery的情况下使用angular

以angular的方式执行此任务,忘记jQuery的一切,只考虑angularjs

棱角的

加价


最好查看此实况演示

因为默认/子视图不是使用angularjs Controllers$scope编译的,请尝试使用ng include。我在哪里使用了ng include查看下面的答案,或者此答案不是向OP提问的最佳位置。
$(document).ready(function () {
   $("#sideMenuCustomerDivition").click(function (e) {
      e.preventDefault();
      $('#subContents').load('Default/subView');
   });
});
var app = angular.module('demo', []);

app.controller('MainCtrl', function($scope) {
  $scope.name ="World!";
  $scope.someVar = 'This is controller content';

  $scope.applyTemplate = function() {

    $scope.template = "mytemplate.html";
  }
});
<body ng-controller="MainCtrl">
    <p>Hello {{name}}!</p>
    <button ng-click="applyTemplate()">Load Template </button>

    <div ng-include="template" ng-if="template"></div>
  </body>