Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different implementation #2

Closed
maysammansoury opened this issue Aug 23, 2017 · 3 comments · Fixed by #3
Closed

Different implementation #2

maysammansoury opened this issue Aug 23, 2017 · 3 comments · Fixed by #3
Assignees

Comments

@maysammansoury
Copy link

maysammansoury commented Aug 23, 2017

Hi my dear friend.
Tanks for your awesome module.
Your module is perfect but implementation according to your instruction doesn't work, so i recommend update your help with my implementation.

<a class="btn form-control"
           [(ngModel)]="myIcon"
           [ipPlaceHolder]="'SearchIcon' | translate"
           [iconPicker]="icon"
           [ipIconPack]="'fa'"
           [ipPosition]="'bottom'"
           [ipFallbackIcon]="myIcon"
           (iconPickerSelect)="onIconPickerSelect($event)"  >
     <i [ngClass]="myIcon"></i>
</a>
@renaudaste
Copy link

Hello !
Glad to hear you like our work.
Icon picker was first intended to be used on an <input> tag, I don't know yet about adding it to a <a>.
I'm going to try your implementation right now, and will update the README then.
I'll keep you updated.
Thank you for your feedback 👍

@renaudaste
Copy link

renaudaste commented Aug 23, 2017

Hello again 😃

Just published a new version 0.0.5-1.
In this version, the iconPickerSelect output is fired on start.

Then I did a test with a new angular-cli project (v1.2.0) using command :
ng new myproject --style less

I managed to make it work following this procedure :

  • Update package.json with :
    "bootstrap": "3.3.7",
    "font-awesome": "4.7.0",
    "ngx-icon-picker": "0.0.5-1",
  • yarn install (or npm install).

  • Update style.less with :

@import '~bootstrap/less/bootstrap.less';
@import '~font-awesome/less/font-awesome.less';
  • Import IconPickerModule :
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { CommonModule } from '@angular/common';
import { IconPickerModule } from 'ngx-icon-picker/dist/index';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    CommonModule,
    BrowserModule,
    IconPickerModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
  • Update the template app.component.html :
<a class="btn form-control"
   [ngStyle]="{backgroundColor: '#f96f6f', width: '50px'}"
   [ipPlaceHolder]="'my placeholder here'"
   [iconPicker]="icon"
   [ipIconPack]="'fa'"
   [ipPosition]="'bottom'"
   [ipFallbackIcon]="fallbackIcon"
   (iconPickerSelect)="onIconPickerSelect($event)"  >
  <i [ngClass]="icon"></i>
</a>
  • Update the component app.component.ts :
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.less']
})
export class AppComponent {
  fallbackIcon = 'fa fa-book';
  icon: string;

  onIconPickerSelect($event: any): void {
    console.log('$event : ', $event);
    this.icon  = $event;
  }
}

With this code the icon picker seems to work well.
Does it seems OK for you ?

Regards

@maysammansoury
Copy link
Author

Hi dear Renaud
Thanks for your quick reply, yes it works perfectly well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants