I have a a string 'I like orange, blue, black, pink, rose, yellow, white, black'. Is it possible to replace words yellow and black with input fields, so I could type in my own colours?
const a: string = 'I like orange, blue, black, pink, rose, yellow, white, black';
const b: string =['black', 'yellow'];
So I would like to have something like this link
Is it possible to do this with javascript or angular2?..
Please, help me...
Here is full code
part2.component.ts
import { Component, OnInit } from '@angular/core';
import { DataService } from '../sample02-simpleService/data.service';
@Component({
  moduleId: module.id,
  selector: 'part2',
  template: `
    <p>{{text}}</p>
    <p>{{itemsSource}}</p>
  `,
  providers: [DataService]
})
export class Part2Component implements OnInit {
  text = 'Hallo';
  public itemsSource: string;
  public itemsSource2: string[];
  public abc: string[];
  constructor(public dataService: DataService) {
  }
  ngOnInit() {
    this.abc = this.dataService.getData3();
    this.itemsSource = this.dataService.getData2();
    this.itemsSource = this.itemsSource.replace(new RegExp(this.abc.join('|'), 'g'),  function myFunction(){return document.write('<input>'); });
  }
}
And I get data from DataService, so from here
import { Injectable } from '@angular/core';
          @Injectable()
export class DataService {
              getData2() {
              let items3: string = 'I like orange, blue, black, pink, rose, yellow, white, black';
              return items3;
            }
            getData3(){
              let items4: string[] = ['black', 'yellow'];
              return items4;
            }
          }
