0
anglejsファクトリを使用して値を設定しています。これはライブメッセージです。mainCtrl
私は現在、$scope.event
にあるデータを取得したいと思います。ユーザー検索ログsearchLogs()
で動作していますが、私はmainCtrl
からデータを取得し続けています。ユーザーがいくつかのポイントでデータを取得したいので、モーダルウィンドウのデータを取得したらバインディングを停止する方法$scope
で利用可能な検索をユーザーが行うことができますか?anglejsファクトリを使用してgetおよびsetを使用する方法は?
factory.js
angular.module('App').factory('searchFactory', function ($http) {
'use strict';
var logs;
return {
getDitLogs : function() {
return logs;
},
setDitLogs : function (data) {
logs = data;
}
}
});
mainCtrl.js
$scope.searchLogs = function() {
$scope.modalInstance = $uibModal.open({
templateUrl: '/view/modals/searchModal.html',
controller:'SearchController'
});
searchFactory.setDitLogs($scope.event);
}
childCtrl.js
$scope.event = searchFactory.getDitLogs();
console.log(searchFactory.getDitLogs());
main.htmlを
おかげで、別の解決策I found.copy(data)は新しいインスタンスを作成します。 – hussain