这是我的代码 - http://plnkr.co/edit/oTWXbLIKOxoGTd4U0goD?p=preview
为什么日子dropdown没有数据绑定scope.demoDays,它总是空的?
这是dropdown动态添加的正确方法吗?如果用户添加5个下拉列表,如何获得结果,将 ng-model="selectedDay"创建一个选择数组?有什么建议?
谢谢
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope, $compile) {
var counter = 0;
$scope.fields = [];
$scope.days =['Day','Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
$scope.addField = function() {
$scope.fields.push({name:"test " + counter++});
};
});
app.directive('demoDisplay', function($compile){
return {
scope:{
demoDisplay:"=", //import referenced model to our directives scope
demoDays:"="
},
link:function (scope, elem, attr, ctrl)
{
scope.$watch('demoDisplay', function(){ // watch for when model changes
elem.html("") //remove all elements
angular.forEach(scope.demoDisplay, function(d){ //iterate list
var …Run Code Online (Sandbox Code Playgroud) 我在逻辑应用程序中有一个接一个的HTTP动作,如何在第二个HTTP动作中读取先前HTTP动作的响应?
第一个HTTP调用(REST)以JSON格式返回响应 -
{
"authResult": {
"isPasswordExpired": true,
"authToken": "cxxcxcxc",
"message": "Login Successful"
}
}
Run Code Online (Sandbox Code Playgroud)
我想authtoken从第二个http动作的结果发送为授权标头.