我的html中有以下行:
<div ng-bind-html-unsafe="departmentConfig" class="control-group"></div>
我使用$resourceget来检索HTML,将HTML分配给$scope.departmentConfig,然后视图完美更新.分配给的HTML $scope.departmentConfig包含表单元素,其中包含ng-model属性,但是当我更改这些输入元素中的值时,它们根本不更新$scope模型.
这是我尝试过的,基于很多其他互联网帖子,它不起作用:
$resource('resources/sources/departments/:mappedName', {
mappedName:departmentKey
}).get(function(departmentConfig) {
// This will call another function that will build a chunk of HTML
$scope.departmentConfig = $scope.buildDepartmentConfigHtml(departmentConfig);
// This is my feeble attempt to access the element, and bootstrap it to include the items in the $scope model.
var $departmentConfigContainer = $('#departmentConfig');
angular.bootstrap($departmentConfigContainer, ['sourcemanager']);
Run Code Online (Sandbox Code Playgroud)
我甚至看到过一些jsFiddle示例,其中似乎有效,但我的不是.我过早地打电话给bootstrap吗?我也试图把一$watch对$scope.departmentConfig这样的:
$scope.$watch('departmentConfig', function() {
var $departmentConfigContainer = $('#departmentConfig');
angular.bootstrap($departmentConfigContainer);
});
Run Code Online (Sandbox Code Playgroud)
但它也没有用.我打赌这有一个简单的解释,我似乎无法获得ng-model …
有没有人有一个例子,说明如何使用MKMapView上的annotationVisibleRect属性将MKMapView缩放到所有可见注释的区域?我已经看到这篇文章提供了一个不错的解决方案,但似乎这个annotationVisibleRect属性将是最简单的解决方案.