2017-10-26 5 views
0

Angular/Ionicの文字列(以下のコードを参照)の代わりに、記述の内容としてHTMLファイルをどのように参照できますか教えてください。 は私が持っていると思います:css.html オブジェクトの値のHtmlファイルの内容

からコンテンツを持っているangular.html

  • items[1].descriptionからのコンテンツを持っている

    1. items[0].descriptionは私を助けてください!前もって感謝します!

      export class BasicPage { 
      
      items = []; 
      
      constructor(public nav: NavController) { 
          this.items = [ 
          { 
          'title': 'Angular', 
          'icon': 'angular', 
          'description': 'A powerful Javascript framework for building single page apps. Angular is open source, and maintained by Google.', 
          'color': '#E63135' 
          }, 
          { 
          'title': 'CSS3', 
          'icon': 'css3', 
          'description': 'The latest version of cascading stylesheets - the styling language of the web!', 
          'color': '#0CA9EA' 
          } 
          ]; 
      } 
      } 
      
  • 答えて

    0

    Iは、HTMLコンテンツを返すために別の関数(例えばgetHTMLFile())を作成お勧めします。 HTMLコンテンツは、HTMLファイル

    http.get("/yout_html_file_path").map((html:string) => this.template = html

    へのHTTP呼び出しを行うと、各アイテムのためにあなたの説明からこの関数を呼び出すと、出力は、この関数から返される文字列化するJSON.stringify()を使用取得します。

    this.items = [ 
        { 
        'title': 'Angular', 
        'icon': 'angular', 
        'description': JSON.stringify(getHTMLFile()), 
        'color': '#E63135' 
        } 
    
    関連する問題