Hello, I am writing a directive on angularJS, to delete some substrings in a string, basically you need to delete the space, the directive itself looks like this

<div remove-substrings=" "></div> 

and I need to substitute a space for quotes & nbsp does not help (just an empty string comes in), = "''" doesn’t help either, write a regular note, as like = "/ g" does not work either, it turns around and turns into a string. How to solve this problem?

  • Show the code for the removeSubstrings directive removeSubstrings . - Stepan Kasyanenko

1 answer 1

By default, removes spaces at the beginning and at the end of lines.

 <div remove-substrings=" " data-ng-trim="false"></div> 

https://code.angularjs.org/1.2.13/docs/api/ng.directive:input.text

  • The string can be copied and there can be spaces in the middle - simply good
  • What is your problem? In the fact that you can not pass a space as an argument to a directive or some other? - Bookin
  • Yes, that’s what I can’t pass space as an argument - simply good
  • Have you tried to turn off the ng-trim? - Bookin
  • Yes, I tried, as you indicated in the answer - simply good