mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
Merge branch 'master' into item-buttons
This commit is contained in:
@ -18,15 +18,18 @@
|
||||
<h6>H6: The quick brown fox jumps over the lazy dog</h6>
|
||||
|
||||
<p>
|
||||
p: The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
I saw a werewolf with a Chinese menu in his hand.
|
||||
Walking through the streets of Soho in the rain.
|
||||
He was looking for a place called Lee Ho Fook's.
|
||||
Gonna get a big dish of beef chow mein.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
He's the hairy-handed gent who ran amuck in Kent.
|
||||
Lately he's been overheard in Mayfair.
|
||||
Better stay away from him.
|
||||
He'll rip your lungs out, Jim.
|
||||
I'd like to meet his tailor.
|
||||
</p>
|
||||
|
||||
</ion-content>
|
||||
|
@ -25,7 +25,7 @@ export class SearchbarInput {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
constructor(public elementRef: ElementRef) {
|
||||
constructor(private _elementRef: ElementRef) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -116,16 +116,17 @@ export class Searchbar extends Ion {
|
||||
blurInput: boolean = true;
|
||||
inputElement: any;
|
||||
searchIconElement: any;
|
||||
mode: string;
|
||||
|
||||
@HostBinding('class.searchbar-focused') isFocused;
|
||||
@HostBinding('class.searchbar-left-aligned') shouldLeftAlign;
|
||||
|
||||
constructor(
|
||||
public elementRef: ElementRef,
|
||||
config: Config,
|
||||
private _elementRef: ElementRef,
|
||||
private _config: Config,
|
||||
@Optional() ngControl: NgControl
|
||||
) {
|
||||
super(elementRef, config);
|
||||
super(_elementRef, _config);
|
||||
|
||||
// If the user passed a ngControl we need to set the valueAccessor
|
||||
if (ngControl) {
|
||||
@ -138,6 +139,8 @@ export class Searchbar extends Ion {
|
||||
* On Initialization check for attributes
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.mode = this._config.get('mode');
|
||||
|
||||
let hideCancelButton = this.hideCancelButton;
|
||||
if (typeof hideCancelButton === 'string') {
|
||||
this.hideCancelButton = (hideCancelButton === '' || hideCancelButton === 'true');
|
||||
@ -152,8 +155,8 @@ export class Searchbar extends Ion {
|
||||
this.shouldLeftAlign = this.value && this.value.trim() != '';
|
||||
|
||||
// Using querySelector instead of searchbarInput because at this point it doesn't exist
|
||||
this.inputElement = this.elementRef.nativeElement.querySelector('.searchbar-input');
|
||||
this.searchIconElement = this.elementRef.nativeElement.querySelector('.searchbar-search-icon');
|
||||
this.inputElement = this._elementRef.nativeElement.querySelector('.searchbar-input');
|
||||
this.searchIconElement = this._elementRef.nativeElement.querySelector('.searchbar-search-icon');
|
||||
this.setElementLeft();
|
||||
}
|
||||
|
||||
@ -174,9 +177,11 @@ export class Searchbar extends Ion {
|
||||
/**
|
||||
* @private
|
||||
* Determines whether or not to add style to the element
|
||||
* to center it properly
|
||||
* to center it properly (ios only)
|
||||
*/
|
||||
setElementLeft() {
|
||||
if (this.mode !== 'ios') return;
|
||||
|
||||
if (this.shouldLeftAlign) {
|
||||
this.inputElement.removeAttribute("style");
|
||||
this.searchIconElement.removeAttribute("style");
|
||||
@ -240,7 +245,7 @@ export class Searchbar extends Ion {
|
||||
// blurInput determines if it should blur
|
||||
// if we are clearing the input we still want to stay focused in the input
|
||||
if (this.blurInput == false) {
|
||||
this.searchbarInput.elementRef.nativeElement.focus();
|
||||
this.searchbarInput._elementRef.nativeElement.focus();
|
||||
this.blurInput = true;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user