Bind jQuery UI autocomplete using .live()

jQuery UI autocomplete function automatically adds the class “ui-autocomplete-input” to the element. I’d recommend live binding the element on focus without the “ui-autocomplete-input” class to prevent re-binding on every keydown event within that element. $(“.foo:not(.ui-autocomplete-input)”).live(“focus”, function (event) { $(this).autocomplete(options); }); Edit My answer is now out of date since jQuery 1.7, see Nathan Strutz’s comment … Read more

Angular 2 output from router-outlet

<router-outlet></router-outlet> can’t be used to emit an event from the child component. One way to communicate between two components is to use a common service. Create a service shared-service.ts import { Observable } from “rxjs/Observable”; import { Injectable } from “@angular/core”; import { Subject } from “rxjs/Subject”; @Injectable() export class SharedService { // Observable string … Read more