I have a list of inputs, created by:
<div ng-controller="MainCtrl">
<div ng-repeat="variable in variables">
<label>{{ variable.slug }}</label>
<input type="text" ng-model="variable.value" ng-change="variableChange()" />
</div>
</div>
And a controller:
function MainCtrl($scope) {
$scope.variables = [
{'slug':'background', 'value':'#666'},
{'slug':'foreground', 'value':'#999'}
]
}
I'm using the less.js to compile the less in the browser, and I want to be able to re-compile it when the variable changes - something like inside the controller:
$scope.variableChange = function() {
less.modifyVars({ variable.slug : variable.value });
};
But I get the error:
ParseError: Unrecognised input in preview-style.less on line 102, column 1:
[email protected]: variable.value;
But if I remove the apostrophes for the variables, I get an angular error:
Bad Argument: Argument 'MainCtrl' is not a function, got undefined
Can anyone help with this?
Edit: here's the less.modifyVars() function if it helps:
less.modifyVars = function (a) {
var b = "";
for (var c in a) b += ("@" === c.slice(0, 1) ? "" : "@") + c + ": " + (";" === a[c].slice(-1) ? a[c] : a[c] + ";");
less.refresh(!1, b)
}