I want to conditionally display a value or an infinity symbol in my Web Page.
I wanted to do something like this ..
<td class="rs-table-text" ng-if="batch.est_completion_time ">{{batch.est_completion_time}}</td>
That is if batch.est_completion_time is not empty then display whatever is coming from json.
And the json looks like :
{
"batch_queue_name": "Batch Five",
"start_date": "05/01/2017 12:18 A.M.",
"end_date": "08/01/2017 03:37 A.M.",
"est_completion_time":"∞",
"completion_status": "42"
}
But it does not display the infinity symbol. Rather , it displays the ∞ text only.
How to achieve the same ?
In your controller, prepare the data as following :
$scope.est_completion_time = $sce.trustAsHtml(batch.est_completion_time);
In your HTML, you can display it as it is. Don't forget to add ng-bind-html in the outer DOM element.
Adding only ng-bind-html can do the job :
ng-bind-html="batch.est_completion_time"
Related
In ng-admin edit view I need to change file upload url with id as below , but I don't know how to fetch id of selected entity in uploadInformation base url like {{entry.values.id}} , below is my code :
files.editionView()
.title('Edit File {{ entry.values.id }}({{ entry.values.filePath}})') // title() accepts a template string, which has access to the entry
.actions(['list', 'show', 'delete']) // choose which buttons appear in the top action bar. Show is disabled by default
.fields([
nga.field('id').label('id').editable(false),
nga.field('file', 'file').uploadInformation({ 'url': baseurl +"files/upload/{{entry.values.id}}"}),// fields() without arguments returns the list of fields. That way you can reuse fields from another view to avoid repetition
])
{{ entry.values.id }} - is an Angular expression and in this form should be used in HTML not in JavaScript.
I assume that entry is your $scope variable, hence you need to write something like this: ... .uploadInformation({ 'url': baseurl+ "files/upload/"+$scope.entry.values.id})
$scope.entry should be prepopulated in your controller's code
I am working on ELK watcher to create an alert that sends an array of value transformed using 'transform' mapping.
"transform": {
"script": "return [ err_yest : ctx.payload.aggregations.errorcount.buckets.collect { [err_count:it.doc_count, list_errors: it.errs.buckets.collect{[emsg:it.key,emsc:it.doc_count]}] } ]"
},
Is there a way to print the array values in the body of email alert using any looping method? I tried groovy scripting, but got an error saying it's unsupported. All I could do is manually printing the values in array like below.
"body" : {
"html": "<table width='400px' border='1'><thead><tr><th colspan='4'>Error Messages</th></tr><tr><th colspan='2'>Yesterday</th><th colspan='2'>Today</th></tr></thead><tbody><tr><td>{{ctx.payload.err_yest.0.list_errors.0.emsc}}</td><td align='center'>{{ctx.payload.err_yest.0.list_errors.0.emsg}}</td><td>{{ctx.payload.err_yest.1.list_errors.0.emsc}}</td><td align='center'>{{ctx.payload.err_yest.1.list_errors.0.emsg}}</td></tr><tr><td>{{ctx.payload.err_yest.0.list_errors.1.emsc}}</td><td align='center'>{{ctx.payload.err_yest.0.list_errors.1.emsg}}</td><td>{{ctx.payload.err_yest.1.list_errors.1.emsc}}</td><td align='center'>{{ctx.payload.err_yest.1.list_errors.1.emsg}}</td></tr><tr><td>{{ctx.payload.err_yest.0.list_errors.2.emsc}}</td><td align='center'>{{ctx.payload.err_yest.0.list_errors.2.emsg}}</td><td>{{ctx.payload.err_yest.1.list_errors.2.emsc}}</td><td align='center'>{{ctx.payload.err_yest.1.list_errors.2.emsg}}</td></tr></tbody></table>"
},
You need to use Mustache templating
The syntax is something like this :
{{#ctx.payload.err_yest}} {{#list_errors}} {{emsc}} {{/list_errors}}{{/ctx.payload.err_yest}}
This will loop over all the objects in err_yest then loop over all the list_errors for a err_yest object and display esmc
I recorded a test with Selenium IDE but when I try to run the test I get an error [error] Element id=jsonform-0-elt-businessActor not found
I also noticed this particular field's id is slightly different.. The rest of the fields have this format id=jsonform-0-elt-0.nameOfJsonAttribute
Could there be any reason why the bussinessActor ID is not working and captured differently?
JsonSchema used to render the form:
{
"type":"object",
"id": "001",
"title": "testSchema",
"properties":{
"businessActor": {
"type":"string",
"title": "Name",
"description": "example of a description."
}
}
}
Note: Am using jsonForm to render the form based on json shema. Form id's are generated dynamically by jsonFom. And am also using Angular.js (angular is not playing a role in this aprticular issue, I think)
As #MarkRowlands suggested, it sounds like your page is dynamic.
Try this out as your target...
css=[id^='jsonform'][id$='businessActor']
^= means 'starts with' in css. $= means 'ends with' in css.
Change that selector to match whatever you would like to select.
I'm using Jade to generate JST templates but I'm having trouble setting placeholder for the id field.
.somediv(id=<%= id %>)
...
Jade compiler throws an error for the above syntax
undefined:501
buf.push(attrs({ terse: true, 'id':(<%= id %>), "class": ('somediv')
Is there a way to do this?
Correct syntax for attributes seems to be:
.somediv(id=id)
...
But if you need id to be exactly <%= id %> then you have to quote it and use != for values that shouldn't be escaped
.somediv(id!="<%= id %>")
...
I want to display bar code but only a coupon in my pass.
Can it work?
such as remove this code in pass.json:
"barcode" : {
"message" : "All you need is love",
"format" : "PKBarcodeFormatPDF417",
"messageEncoding" : "iso-8859-1"
}
To remove barcode from Pasbook' Pass just remove the whole barcode section from the pass.json and rebuild the pass.