I have code preview that displays json object. I want to add line number before each line. The code is working great, but I'm unable to add the line number before each line. I'm using angularJS 1.5.8. In order to display the json I'm using the angularJS json filter.
I want it to look something like that:
1 | {
2 | "a": 1,
3 | "b": 2
4 | }
now it looks like that:
{
"a": 1,
"b": 2
}
My html template:
<pre id="previewArea"><code>{{ $ctrl.myObj | json : 4}}</code></pre>
My angularJS component:
ctrl.myObj={
a:1,
b:2
}