style an element using an angular filter - angularjs

I would like to style a couple of elements using a filter to decipher if it should be yellow or red.
I understand filters should not carry logic operations in them as such so am guessing a service is the first port of call before i create any filter for it.
I am leveraging data from a backend (still a bit unsure of the Backend model here, but know I can leverage certain objects to obtain the data needed for working on) I mostly need to know if i`m on the right path by using a service to control the logical outcome and then a filter to provide 'filtration' of that outcome.
BTW: sorry, im waiting for my project to checkout from SVN at mo so cannot provide a skeleton attempt.
Will do in a bit though .....
Any advice before hand will be much appreciated
:) Gruffy - thanks for reading

You can directly set the class attribute if you want, so your filter can simply return the CSS class to apply:
<p class="{{'foo'|myFilter}}">Foo</p>
Here's a fiddle showing what I mean.

Related

Datagrid selection get lost ramdomly

I am using VMWare Clarity datagrid with single selection.
Behind the scene, I am receiving updated data and randomly, the selected row is no more selected.
I found those links where they seemed to have the same issue and looks like it is fixed in 0.12.2, but I don't see that from side:
https://github.com/vmware/clarity/issues/484
https://github.com/vmware/clarity/issues/2342
Here my code
html
<clr-datagrid [clDgRowSelection]="true" [(clrDgSingleSelected)]="selectedUnit">
...
<clr-dg-row *clrDgItems="let unit of units" [clrDgItem]="unit" (click)="backupSelectedUnit(unit)">
...
</clr-dg-row>
</clr-datagrid>
JS
myfunc() {
this.units = this.getUpdatedUnits();
}
Thanks in advance
You are missing the trackBy on *clrDgItems. Whenever you are dealing with objects you receive from the server, you really want to make sure you are using trackBy to help Angular (and thus Clarity) know how to compare your objects. Otherwise the only comparison Angular can perform is reference equality, which isn't preserved when you keep getting updated objects from the server. Here is the official documentation for it, and you can find a maybe more readable explanation in the template syntax docs.
*clrDgItems supports the same trackBy option as *ngFor, so you can just write:
<clr-dg-row *clrDgItems="let unit of units; trackBy: trackById" ...>
where trackById is a function you add to your component that looks like this:
trackById = (index, unit) => unit.id
I'm assuming here that the objects you receive from the server have an id, but you can use any other way to identify them depending on your specific use case.

DMN Decision Table Output

I am new to decision table so please forgive me if I asked a very basic question. I am working on an angular web app that uses decision table.
Could we change the table header 'Output' to something else?
Unfortunately, I cannot find any such label neither in the HTML nor in the controller.
For future reference:
It cannot be done through CSS. therefore following is my solution.
Inspect the code that either the dmn table is using modeling module or some other bpmn table features. In my case, it is using modeling. I override the following module by inheriting from it, to make the Input header cell dynamic and output fixed or change the label as well.
https://github.com/bpmn-io/dmn-js/blob/31803afe1bdccdc350da73293a75e2cbf3f14932/lib/table/features/modeling/Modeling.js

How to make drill down tables in Zeppelin?

I am trying to make each value in one of the column of table as clickable so that I can develop drill down functionality using Zeppelin Table. But following sample code is not working at all.
print(s"""%table
a\tb\n%html <button>x</button>1\t2\n%html <button>y</button>3\t4
""")
It will take quite some effort to make this work.
The basic idea is converting a data source (e.g. Spark DataFrame) to a complete and self contained HTML section and which is interpreted by Zeppelin. Hide and show need to be handled by javascript library.
Zeppelin using Bootstrap, so we shall use bootstrap library directly. This SO might help Bootstrap cllapse. Perhaps need more styling.
If you are just wanna drilldown function while not strictly with table. And if you are using Spark, it might be a bit easy with spark-highcharts to implement the feature like Highcharts column drill down
Finally my code worked. The issue seems to be if you have html tag in the first column, it will not work. However, it works in all the other columns. Just add one more cols in the front and it worked.
print(s"""%table
dummy\ta\tb\np1\t%html <button>x</button>1\t2\np1\t%html <button>y</button>3\t4
""")

How to custom placeholder in international phone number plugin

I have problem with custom placeholder. I am using this https://github.com/mareczek/international-phone-number I want to add more ex. E.g. 131123456789 to my place holder which default gave something like this 131123456789. I read the document they use customPlaceholder to custom place holder, but they do not have any example with angularjs, so could someone show me example code with custom place holder like this.
Here my code that I added to my app
app.config([
'$stateProvider',
ipnConfig,
register_form_state
])->ipnConfig.customPlaceholder = 'E.g. 131123456789'
but it doesn't work for me.
This will solve this problem
http://hodgepodgers.github.io/ng-intl-tel-input/
Please refer this link & this is angularJS plugin
https://github.com/hodgepodgers/ng-intl-tel-input
On selection of country, placeholder will change
The documentation for http://hodgepodgers.github.io/ng-intl-tel-input/ is lacking, but it seems like it could be a good tool. I think I would personally like to see a working implementation inside of an existing application before I'd rule it as the solution to use. I'm still having trouble implementing this one compared to the one by mareczek.
edit To answer your question, I think that it changes the placeholder based on the flag you have selected. If you have it set to a default country, can you not just change the placeholder in the html? Or can you target it directly using css?

Implementing basic next/previous picture

I'm trying to convert the Adjuster example mentioned here: http://agiletoolkit.org/learn/understand/view/interactive
into a View that is able to show me the next/previous picture of a list of given images.
I guess the number in the example could be an index into an array of pictures.
I'm just not sure how to provide the list of pictures, when all the code is put in init() for the View, so no way to give it the picturelist before that...
Should I use memorize/recall for this list also to prevent it getting lost upon reload ?
is there another example that might help me?
I think you what you are doing can be much easier done with a classic JavaScript Lightbox script. You would supply it list of images and it would show one full-screen.
If not, you can use this:
https://gist.github.com/romaninsh/7217119
This will give you slides similar to the ones on http://agiletech.ie/
Be advised that this code is a little old.

Resources