use scope only
This commit is contained in:
parent
00ef6bdb62
commit
aa49f03fc1
2 changed files with 21 additions and 28 deletions
|
|
@ -2,10 +2,10 @@
|
|||
ng-init="titleSection='Color'; goBackToState = 'preferences'">
|
||||
</div>
|
||||
|
||||
<div class="content preferences" ng-controller="preferencesColorController as p" ng-init="p.init()">
|
||||
<div class="content preferences" ng-controller="preferencesColorController">
|
||||
<h4></h4>
|
||||
|
||||
<ion-radio class="size-12" ng-repeat="c in p.colorList" ng-value="c" ng-model="data.currentColor" ng-click="p.save(c)">
|
||||
<ion-radio class="size-12" ng-repeat="c in colorList" ng-value="c" ng-model="currentColor" ng-click="save(c)">
|
||||
<span ng-style="{'color': c}">█</span>
|
||||
</ion-radio>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesColorController',
|
||||
function($scope, $timeout, $log, configService, profileService, go) {
|
||||
var config;
|
||||
var fc = profileService.focusedClient;
|
||||
var walletId = fc.credentials.walletId;
|
||||
angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $log, configService, profileService, go) {
|
||||
|
||||
this.init = function() {
|
||||
this.colorList = [
|
||||
$scope.colorList = [
|
||||
'#DD4B39',
|
||||
'#F38F12',
|
||||
'#FAA77F',
|
||||
|
|
@ -24,25 +19,23 @@ angular.module('copayApp.controllers').controller('preferencesColorController',
|
|||
'#7A8C9E',
|
||||
];
|
||||
|
||||
config = configService.getSync();
|
||||
config.colorFor = config.colorFor || {};
|
||||
var fc = profileService.focusedClient;
|
||||
var walletId = fc.credentials.walletId;
|
||||
var config = configService.getSync();
|
||||
config.colorFor = config.colorFor || {};
|
||||
|
||||
$scope.data = {
|
||||
currentColor: config.colorFor[walletId] || '#4A90E2'
|
||||
};
|
||||
$scope.currentColor = config.colorFor[walletId] || '#4A90E2';
|
||||
|
||||
$scope.save = function(color) {
|
||||
var opts = {
|
||||
colorFor: {}
|
||||
};
|
||||
opts.colorFor[walletId] = color;
|
||||
|
||||
this.save = function(color) {
|
||||
var self = this;
|
||||
var opts = {
|
||||
colorFor: {}
|
||||
};
|
||||
opts.colorFor[walletId] = color;
|
||||
|
||||
configService.set(opts, function(err) {
|
||||
go.preferences();
|
||||
if (err) $log.warn(err);
|
||||
$scope.$emit('Local/ColorUpdated');
|
||||
});
|
||||
};
|
||||
});
|
||||
configService.set(opts, function(err) {
|
||||
go.preferences();
|
||||
if (err) $log.warn(err);
|
||||
$scope.$emit('Local/ColorUpdated');
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue