Skip to content

Instantly share code, notes, and snippets.

@amitmerchant1990
Created January 19, 2017 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitmerchant1990/efab4114a0d838f329cf4e923cd1e3db to your computer and use it in GitHub Desktop.
Save amitmerchant1990/efab4114a0d838f329cf4e923cd1e3db to your computer and use it in GitHub Desktop.
import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';
import { NavController } from 'ionic-angular';
import marked from 'marked';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild(Content) content: Content;
constructor(public navCtrl: NavController) {
//console.log(marked('I am using __markdown__.'));
}
convert(this) {
if(this.toggleVal==true){
if(this.plainText && this.plainText!=''){
let plainText = this.plainText
this.markdownText = marked(plainText.toString())
this.content = this.markdownText
}else{
this.toggleVal=false
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment