md-chips and md-autocomplete input field - angular-material

When user enters an input with md-chips and the focus is removed the entry is still there. is there a way to delete any entry that is not a chip once the focus is removed?
The Out Standing Text still shows once the focus is removed

Normally, you should be able to do it by using ng-blur but for some reason there is an issue with that directive in use with md-autocomplete: https://github.com/angular/material/issues/3906
But i tried to solve it differently, not the most correct way, but it works. What you have to do is bind event with blur in input inside md-autocomplete. In this event you have to clear your searchText of md-autocomplete. So just bind that event in your controller somehow like that:
angular.element(document.querySelector('md-autocomplete input')).bind('blur',
function(){
setTimeout(function(){
angular.element(document.querySelector('md-autocomplete')).scope().ctrl.searchText = '';
angular.element(document.querySelector('md-autocomplete')).scope().$apply();
}, 300);
}
)
The reason why I used timeout was the fact that chip was not added if searchText variable was cleared too fast. But when I added 300ms delay it worked as I expected. For sure there is better way to do it, but just try to do it this way and maybe it will be enough for you.
Here is working codepen: http://codepen.io/anon/pen/QdNydx

Related

Is there any way to listen to mouse::enter signal for awful.menu

I've recently started to use and customize awesomewm, and I'm really happy with how all components work together and with the related documentation.
Though I'm sometimes really disturbed when using the menu (awful.menu) and it's nature to block some actions. So I've wanted to add listener to the mouse::enter and mouse::leave signal to allow the widget to hide itself once the mouse leaves the widget area.
Something like:
menu:connect_signal('mouse::enter', function()
naughty.notify({
preset = naughty.config.presets.critical,
title = "Entered",
text = "Entered"
})
end)
But those signals don't seem to be emitted by this widget. I've dug through the docs but don't seem to find any documentation about signals emitted by this widget. My question is then: Is there any other signal with same functionality, or is this not possible with awful.menu?
The menu is a complicated object. You can dig in its internal and access menu.wibox:connect_signal("mouse::enter", function() end), but this is only the top-level wibox. Submenus generate their own menu instance and they only create that dynamically.
Thus, there is no easy way to connect signals like this, sorry.

Not able to click on POST button with xpath code

driver.findElement(By.xpath("//*[#id=\"ember558\"]")).click();
I am doing testing for linkedin post. I entered this code for POST button but that does not work. Can you please suggest about this?
It seems that #id attribute value is dynamic so, it will not be able to interact with the Element. You can try with dynamic X-path techniques. Generally, a set of data keeps on changing and rest data remains same.
e.g. <button "id":"emns1233">
here starting part of id will remain same every time but last part that is 1233 will change (may be each time). So, one can try to write X-path as
driver.findElement(By.xpath("//button[starts-with(#id,'emn')])).
Hope it helps. Thanks

there doesn't seem to be a polymer-layout event

I'm looking for an event fired by polymer-layout when it's finished laying out, similar to the polymer-grid-layout event. Doesn't seem to be one. Am I missing something?
After my attempts at polymer-grid-layout (Autosizing canvas inside a polymer grid layout) I've decided to convert everything to nested polymer-layouts instead. After a few hiccups (e.g. the dart version of polymer-layout doesn't work if you put polymer-layout as an element directly under template, whereas the js version does - don't know which is wrong) the approach seems to be working.
The one exception is that I was previously relying on polymer-grid-layout to tell me when the canvas had been resized properly. But with polymer-layout I have the same timing problem but without the same solution it appears.
Any way around this?
thanks
Anders
Dart polymer_element/polymer_ui_element are a bit outdated. I'll take a look at what changes were be made in JS polymer-layout since I last revisited Dart polymer-layout (probably Mo/Di).
Can you please create an issue in https://github.com/ErikGrimes/polymer_elements so you get notified when the update is made.
You are right that polymer-layout is missing a layout event. I filed an issue here https://github.com/Polymer/polymer-layout/issues/3
In the meantime, you should be able to capture the timeline in attached.
attached: function() {
this.async(function() {
this.async(this.layoutHappened);
});
},
layoutHappened: function() {
}
I used nested async because I don't want to worry about whose attached is called first (this one, or the one in the polymer-layout). And yes, this is exactly the kind of fiddly construction that is avoided by having an event.

blackberry: onkeyup doesn't catch BACKSPACE

i need to get value of a INPUT of type TEXT in real time. So i assigned to onkeyup of the INPUT to my function, that evaluates the new value.
It works fine on BB (i use 9780/OS6 for tests) except, that BACKSPACE-Key doesn't fire the event.
Here there's an example of code.
may be you have an idea, how to solve it.
Thanks a lot in advance!
Daniel

Bind functions to elements inserted in the DOM? (Implicitly?)

This is probably jquery basics, but I can't find a solution after much googling.
How do you attach "non-events" to elements inserted in the DOM?
For events, like click, we can use live() or bind().
How would you, for instance, initialize tabs() or addClass() to a new element?
Specifically, I'm trying to get tabs() to work in the content of an ajax loaded dialog, but I think the correct solution should be applicable to any situation.
I did see a trick that involved $('body').mousemove() which did work, but that is still binding to an event and obviously a hack.
For instance, how would you get addClass() to fire on a newly inserted table row?
I mean to do this implicitly, meaning that I don't want to write out specific instructions for every event that adds nodes to the dom, I just want it to "run in the background".
Let me know if this needs clarification, I see many similar questions on SO but no answers that have helped.
EDIT: Simple example: A page calls $('a').addClass('highlight') which works on all anchors in the page. A new anchor is then added to the page dynamically by jQuery, but does not get the class added.
EDIT: I have tried all kinds of bind(), trigger() and change() methods but I'm afraid I'm barking up the wrong tree.
you need to look at livequery it will allow you to apply things to newly added elements
also if your adding the element you can do
$('body')append('<div>some content</div>').tabs();
or something like that
I know that I may contradicting your "non-event" rule here, but just by saying that you want something "triggered", you're already implying some kind of event.
In that case, may I suggest jQuery custom events? You may want to create a custom event, then trigger it manually somewhere in your code. It's not automatic (like when you add a row, BOOM, it fires™), but that's the closest thing I can think of with what you were describing.
Specifically, you may want to look at jQuery's .bind() and .trigger() methods.

Resources