Merge pull request #178 from gabrielbazan7/fix/preferencesEmail

fix email
This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-23 13:38:47 -03:00 committed by GitHub
commit a8568db32e
2 changed files with 7 additions and 5 deletions

View File

@ -11,7 +11,7 @@
<div class="card list"> <div class="card list">
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label" transalate>Email for wallet notifications</span> <span class="input-label" transalate>Email for wallet notifications</span>
<input type="email" id="email" name="email" ng-model="email" required></input> <input type="email" id="email" name="email" ng-model="email.value" required></input>
</label> </label>
</div> </div>
<button type="submit" <button type="submit"

View File

@ -7,16 +7,18 @@ angular.module('copayApp.controllers').controller('preferencesEmailController',
var config = configService.getSync(); var config = configService.getSync();
config.emailFor = config.emailFor || {}; config.emailFor = config.emailFor || {};
$scope.email = config.emailFor && config.emailFor[walletId]; $scope.email = {
value: config.emailFor && config.emailFor[walletId]
};
$scope.save = function(form) { $scope.save = function() {
var opts = { var opts = {
emailFor: {} emailFor: {}
}; };
opts.emailFor[walletId] = $scope.email; opts.emailFor[walletId] = $scope.email.value;
walletService.updateRemotePreferences(wallet, { walletService.updateRemotePreferences(wallet, {
email: $scope.email, email: $scope.email.value,
}, function(err) { }, function(err) {
if (err) $log.warn(err); if (err) $log.warn(err);
configService.set(opts, function(err) { configService.set(opts, function(err) {