I'm currently learning Angular. I am having trouble converting a specific long string.
So this is my div with a lot of lines generated by ng-repeat:
http://pastebin.com/raw/bJqqUvpY
Yes, this is pretty unpleasant, I know. I want to remove all ng attributes and other things that I don’t need from this line, because I will pass this data to PHP through ajax.
Here is what I tried to do (angular):
$scope.updateHtml = function() {
var testVal = angular.element('#sendHtml').val();
testVal = testVal.replace(/ng-class="{'selected':selection.indexOf($index) != -1}"/g,"");
$scope.sendHtml.html = testVal;
};
But that will not work. Perhaps it is because of the quotes inside the phrase, or is it?
This, for example, works with replacing one letter:
$scope.updateHtml = function() {
var testVal = angular.element('#sendHtml').val();
testVal = 'abcabcabc';
testVal = testVal.replace(/b/g,"");
$scope.sendHtml.html = testVal;
};
$scope.sendHtml.html 'acacac' .
RegEx? , . !
!