I'm currently facing a multi-faceted 'problem' which can be divided in a few steps.
The user of a framework will be able to add settings dynamic to the UI via an XML-file which will be read when opening the settings page. Example:
<settings>
<group>
<groupname>Profile settings</groupname>
<groupsettings>
<setting type="range" savename="volumeslider">
<label>Volume</label>
<min>0</min>
<max>10</max>
<step>1</step>
<default>5</default>
<labelleft>Low</labelleft>
<labelright>High</labelright>
</setting>
<setting type="checkbox" savename="brightnesstoggle">
<label>Brightness</label>
<default>true</default>
</setting>
</groupsettings>
</group>
</settings>
As you can see a range-slider (input type="range") and a checkbox (input type="checkbox") is defined here.
Currently the XML gets parsed with an ajax call
$.ajax({
type: "GET",
url: "settings/globalapp.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('group').each(
function(){/* Parse code here */}
})
This gets parsed to a long string and then the string is appended to the correct place in the UI.
$("ul>.globalList").append(outputString);
outputString = "<input type="range" min="0" max="10" value="5" ng-model="volumeslider" ng-change="settingsInputChanged(volumeslider, 'volumeslider')">"
As you can see I have a ng-change binding, but this doesn't work when the code gets appended with jQuery. When I hardcode this string into my HTML, it works perfectly (with settingsInputChanged being a generic function to add the value of the settings to the localStorage).
Am I tackling the problem completly wrong or has Angular a simple, built-in way to handle this?