create view and controller refactor

This commit is contained in:
Gabriel Bazán 2017-05-22 21:28:41 -03:00
commit d55e756e6a
6 changed files with 33 additions and 30 deletions

View file

@ -19,18 +19,18 @@ angular.module('copayApp.controllers').controller('createController',
12: 1,
};
$scope.init = function(tc) {
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.formData = {};
var defaults = configService.getDefaults();
var tc = $state.current.name == 'tabs.add.create-personal' ? 1 : defaults.wallet.totalCopayers;
$scope.formData.account = 1;
$scope.formData.bwsurl = defaults.bws.url;
$scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
$scope.formData.totalCopayers = defaults.wallet.totalCopayers;
$scope.formData.derivationPath = derivationPathHelper.default;
$scope.setTotalCopayers(tc);
updateRCSelect(tc);
resetPasswordFields();
};
});
$scope.showAdvChange = function() {
$scope.showAdv = !$scope.showAdv;
@ -60,7 +60,7 @@ angular.module('copayApp.controllers').controller('createController',
};
function resetPasswordFields() {
$scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatpassword = $scope.result = null;
$scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatPassword = $scope.result = null;
$timeout(function() {
$scope.$apply();
});

View file

@ -43,7 +43,7 @@ angular.module('copayApp.controllers').controller('joinController',
};
function resetPasswordFields() {
$scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatpassword = $scope.result = null;
$scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatPassword = $scope.result = null;
$timeout(function() {
$scope.$apply();
});

View file

@ -341,7 +341,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/create-personal',
views: {
'tab-home@tabs': {
templateUrl: 'views/tab-create-personal.html'
templateUrl: 'views/tab-create-personal.html',
controller: 'createController'
},
}
})
@ -349,7 +350,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/create-shared',
views: {
'tab-home@tabs': {
templateUrl: 'views/tab-create-shared.html'
templateUrl: 'views/tab-create-shared.html',
controller: 'createController'
},
}
})