かなり基本的なもの...のために働いていないことは、それが動作するはずのように思えるが、ここではないreturn文は、オブジェクト
どちらのコンソールログは、正しい情報を吐き出すん。
$scope.getCurrentAttachment = function() {
angular.forEach(attachments, function(attachment) {
console.log(attachment);
if(attachment.active) {
console.log(attachment);
return attachment;
}
});
};
しかし、それ以降のファイルでそれを呼び出すくらいにappriciatedされるだろうすべてのヘルプ未定義
$scope.save = function() {
console.log($scope.getCurrentAttachment());
var data = [$scope.labels.selected, $scope.getCurrentAttachment()];
console.log(data);
$uibModalInstance.close(data);
};
になります。私は、これはあなたがここに持って
「添付ファイル」とは何ですか?これは引数として$ scope.getCurrentAttachmentに渡されていません。スコープ変数、グローバル変数、...? – jbrown
何がうまくいくはずですか? 'undefined'とは何ですか? '$ scope.getCurrentAttachment'関数か' attachment'変数ですか? [ask] [mcve] – TheSharpieOne
を使用して$ scope.getCurrentAttachment()の戻り値は未定義です。 添付ファイルは、ログに正常に表示されるオブジェクトの充実した配列です –