how to add next line \n inside array in widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 09:58 AM - edited 02-13-2024 09:59 AM
Hello developers, i have to make two string in diff lines.currently it is in single line liketest1 test2 [ok] but i need
test1[ok]
test2[ok]
* c.data.ip_ok message gives this [ok]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 11:01 AM
You could try using <br> for HTML instead of '\n' which is Javascript.
var br = document.createElement('br').
temp.appendChild(br);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 11:23 AM - edited 02-13-2024 11:29 AM
Hi machine, thanks for the response. yes i tried but couldnt get in the next line.
Please help me how to convert object to array in javascript as the input is taken as
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 11:40 AM
The solution is to either place br elements between the lines, or to wrap each text within p or div (or any other element displayed as block).
But in AngularJS HTML is supposed to be defined only in Body HTML template.
One should absolutely not use DOM manipulation, like creating nodes.
While it is "allowed" in link functions, it should be avoided.
So the solution needs tinkering both with the Client controller and the Body HTML template.
Example:
- Body HTML template:
<div> <p ng-repeat="line in lines">{{ line }}</p> </div>
- Client controller:
api.controller = function ($scope) { var c = this; $scope.lines = [ 'Line 1', 'Line 2', ]; };
This results in: