In my Angular project, I have an input field structured like this:
<input class="form-control" type="text" ng-model="newBook.color">
Whenever the value in this input changes, I want to dynamically change the background color of a specific div.
Within my controller, I have defined the following variables:
$scope.newBook = {};
$scope.newBook.color = "";
$scope.color = ->
return "background-color: " + $scope.newBook.color;
The div that should reflect the color change looks like this:
<div ng-style="{{color()}}"></div>
Despite my efforts, I encountered an error message stating:
Error: [$parse:syntax] Syntax Error: Token ':' is an unexpected token at column 17 of the expression [background-color:]