我在创建新帖子时使用select2创建一个带有功能标签的div.
Stack是Angular 1.6.x.
当我在创建新帖子时,它很有效.但是当我在编辑所述帖子时添加预先选择的值时,预选值永远不会从默认值更改.
简而言之,这些值没有约束力.
见下文:
HTML片段:
<div class="form-group">
<label for="tags" class="control-label">Tags</label>
<select name="tags" class="tagsSearch" class="form-control" id="tags"
ng-options="tag as tag for tag in post.tags track by tag"
ng-model="post.tags" style="width: 100%" multiple>
</select>
</div>
Run Code Online (Sandbox Code Playgroud)
注意:它看起来很乱,但是我得到这个来显示我的原始标签
控制器片段:
$http.get('/api/post', {params: { title: $scope.title }})
.then(function(res){
$scope.post = res.data.post;
});
$scope.updatePost = function() {
console.log($scope.post.tags);
};
Run Code Online (Sandbox Code Playgroud)
问题是标签没有绑定,所以如果值是:tag1,tag2,tag3在渲染时我添加:tag4 - updatePost控制台tag1,tag2和tag3
PS:我的标签是一个字符串数组,没有像ID一样的键(看到其他一些引用它们的帖子).
很丢失.任何意见都将受到高度赞赏.
谢谢
编辑 - 2018年4月28日:
我已将我的标签更新为数组的对象,如下所示:
[
{tag: "tag1", _id: "5ae410756b7a61080cd17c81"},
{tag: "tag2", _id: "5ae410756b7a61080cd17c80"},
{tag: "tag3", _id: "5ae410756b7a61080cd17c7f"}
] …Run Code Online (Sandbox Code Playgroud) 我最近将 Angular 从 1.5.x 更新到 1.6.4,现在,当我转到表单时,每当我尝试在表单/文本框中键入内容时,都会收到以下错误消息:
TypeError: Attempted to assign to readonly property.
Run Code Online (Sandbox Code Playgroud)
这是我的控制器:
mainApp.controller('newPostController', ['$scope', '$http', function($scope, $http){
$scope.post = '';
$scope.postCreated = false;
$scope.makeNewPost = function() {
$http.post('/api/post', {
title: $scope.post.title,
})
.then(function(res){
$scope.postCreated = true;
//extra code not related to the form itself...
};
}]);
Run Code Online (Sandbox Code Playgroud)
我的 HTML 如下所示:
<form ng-submit="makeNewPost()">
<div class="form-group">
<label for="title" class="control-label">Title</label>
<input type="text" autocomplete="off" class="form-control" ng-model="post.title" id="title" required="required">
</div>
<input type="submit" value="Submit">
</form>
Run Code Online (Sandbox Code Playgroud)
我查了一下这个错误,我看到的一切都与我的设置无关。
请帮我解决这个问题。我不知道从这里去哪里。
谢谢
我有一个奇怪的问题,我似乎无法去任何地方。我已经遵循了网上的所有内容(多个教程等),但无法让sts.assumeRole工作。
我的设置:
我有一个在子 AWS 账户 1中运行的机器人,我需要来自主 AWS 账户的定价信息。
因此,我在主 AWS 账户上创建了一个角色来拥有 AWS ce:* 访问权限,如下所示:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["ce:*"],
"Resource": ["*"]
}]
}
Run Code Online (Sandbox Code Playgroud)
信任关系
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com",
"AWS": "arn:aws:iam::SubAWSaccount1-ID:role/instance-profile"
},
"Action": "sts:AssumeRole"
}
]
}
Run Code Online (Sandbox Code Playgroud)
现在,这是附加到在子 AWS 账户 1上运行的 EC2 实例的实例配置文件:
"Version": "2012-10-17", …Run Code Online (Sandbox Code Playgroud) 我已经创建了一个启动配置,并使用它来创建Auto Scaling组。
从启动配置创建Auto Scaling组时,出现以下错误:
Description:DescriptionLaunching a new EC2 instance. Status Reason: The requested configuration is currently not supported. Please check the documentation for supported configurations. Launching EC2 instance failed.
Cause:CauseAt 2017-08-15T10:54:52Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.
Run Code Online (Sandbox Code Playgroud)
我环顾四周,仅找到此链接。但是,它并没有告诉我确切不支持的内容,因此并没有太大帮助。
我的启动配置如下所示:
我的Auto Scaling组如下所示:
和:
对不起,我不得不屏蔽掉一些包含客户数据的项目。
任何输入都会有所帮助。由于日志中的任何地方都没有信息,所以我不知道从这里到哪里。
PS:我曾尝试更改实例类型,但没有运气。认为可能是原因,但显然不是。