*partial*
<div ng-if="movetoExsisting">
<strong>Move to Existing</strong> <br>
<div ng-if="!toEnterprise">
<input type="text" ng-model="selectedEnterprise"
typeahead-on-select="selectToEnterprise($item, $model, $label)"
placeholder="Search for a Enterprise" typeahead="result.label for result in
getEnterprises($viewValue)" typeahead-loading="loadingLocations"
class="form-control">
<!-- <a ng-click="SelectMoveToNew()">Create New
Enterprise</a> -->
</div>
<div ng-if="toEnterprise">
<strong> Selected Enterprise:</strong>
{{toEnterprise.name}} {{toEnterprise.id}} <a
ng-click="removeToEnterprise()">Remove</a>
</div>
</div>
*controller*
$scope.SelectMoveToExsisting = function(){
$scope.toEnterprise = null;
$scope.movetoNew = false;
$scope.movetoExsisting= true;
}
//Once again two-way binding killing have to do this on every update
$scope.updateEnterpriseName= function (name){
$scope.newEnterpriseName = name;
}
//$scope.selectedAccounts doesnt seem to bind back to ctr in modal.
$scope.submitMove = function(){
//if(!$scope.toEnterprise) return;
console.log("--------------");
console.log($scope.newEnterpriseName)
console.log($scope.toEnterprise);
//INTERFACING WITH OLD SCHOOL FORM SUBMITS HERE
var selAccounts =
_($scope.selectedAccounts).chain().flatten().pluck('id').unique().value();
console.log("sel accounts");
console.log(selAccounts);
console.log(enterprise.id)
var thedata ={
id:enterprise.id,
successUrl: '%2Fxo360%2Fenterprise%2Fshow%2FEID000050',
account: selAccounts,
newId: '',
type:'id'
}
if($scope.movetoExsisting){
thedata.newId= $scope.toEnterprise.id;
}else if($scope.movetoNew){
// alert( $scope.newEnterpriseName);
thedata.newName = $scope.newEnterpriseName;
}else{
return false;
}
var params = $.param( thedata,true );
console.log("Submitting");
console.log(params);
var request = $http({
method: "GET",
url: contextPath + "/enterprise/moveAccounts?"+params,
headers: {'Content-Type': 'text/html'}})
.then(function(response){
console.log("Response");
console.log(response);
if(response.data.responseCode ==0){
$scope.cancel();
}else{
$scope.errorDesc = "Error Submitting your Request: " +
response.data.errorDesc;
}
})
console.log($scope.selectedAccounts);
}
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.