I want to make a dotted string to fill up the gaps with the appropriate (drag-able) word to complete the sentence.
string like:
The ______ brown ______ jumps over the ______ dog.
words like: quick, fox, lazy
but when I bind the string with ng-bind-html the jqyoui-droppable is not working in the return string. Couldn't drop the button(drag-able key) in the gap string.
$scope.gapList = [];
$scope.string = "The quick brown fox jumps over the lazy dog.";
$scope.keys = ['quick','fox','lazy'];
$scope.createDottedString = function () {
for (var key in $scope.keys) {
$scope.string = $scope.string.replace($scope.keys[key], '<em data-drop="true" data-jqyoui-options jqyoui-droppable ng-model="$scope.gapList" > ____________ </em>');
}
return $sce.trustAsHtml($scope.string);
};
html: <div ng-bind-html="createDottedString()"></div>
here is the plnkr link: demo
I've used this jqyoui-droppable plugin for drag and drop with jqueryUI.