I'm just starting out with Angular (again).
I'm looking for two related questions to be answered regarding the following plunker
http://plnkr.co/edit/anfQW9NcZs1WuPL8yKdJ
var app = angular.module('Designer', [])
.factory('TextModel', function () {
return {
'textAlign': 'left',
'fontFamily': 'Arial'
};
});
app.controller('TextController', function($scope, TextModel){
$scope.master = TextModel;
$scope.$watch("master",function(){
$scope.textStyles = {
'text-align': $scope.master.textAlign,
'font-family': $scope.master.fontFamily
};
}, true);
$scope.setAlignment = function(newAlignment){
$scope.master.textAlign = newAlignment;
};
$scope.setFont = function(font){
$scope.master.fontFamily = font;
};
});
In this, how can I apply the styles to only the currently focused input box rather than both.
And similarly, if I then change the font of one to Times and the other to Verdana, when I click either how do I update the select box to the font of the selected / focused input box.
Thanks