I want to update the scope
my filterconditions.js file
SCAApp
.directive('filtercondition', ['ngDialog',
function (ngDialog) {
return {
restrict: 'A',
replace: true,
scope: {
conditionsinput: "=",
tables: "=",
operatorsinput: "=",
treeinput: "=treeinput"
},
templateUrl: '../../Scripts/app/shared/directives/filterconditions/partials/filterconditions.html',
link: function (scope) {
scope.$watch('tree', function () {
scope.treeinput = scope.tree;
});
scope.generateUid = function () {
var d = new Date();
var uid = d.getTime();
return uid;
};
scope.conditions = scope.conditionsinput;
scope.operators = scope.operatorsinput;
scope.tree = scope.treeinput;
}
}]);
my html page
<div filtercondition conditionsinput="conditions" tables="tables" operatorsinput="operators" treeinput="tree"></div>
$scope.tree = [{ nodes: [], fields: [], id: $scope.generateUid(), condition: $scope.conditions[0], visibility: true, selectColumns: [] }];
in this situation, scope.tree is updated, but see this
dataFactory.get("/BusinessView/GetBusinessViewById?applicationId=" + $scope.currentAppId + "&viewId=" + $scope.$stateParams.viewId + "&objectId=" + $scope.$stateParams.formId)
.then(function (result) {
$scope.tree =[{ nodes: [], fields: [], id: $scope.generateUid(), condition: $scope.conditions[0], visibility: true, selectColumns: [] }];
});
in the above case the scope.tree in the directive is not updated, please give a solution