|
@@ -1,5 +1,6 @@
|
|
import { Component } from '@angular/core';
|
|
import { Component } from '@angular/core';
|
|
import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
|
import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
|
|
|
+import { FormBuilder, Validators, FormGroup } from '@angular/forms';
|
|
|
|
|
|
/**
|
|
/**
|
|
* Generated class for the WriteTweetPage page.
|
|
* Generated class for the WriteTweetPage page.
|
|
@@ -15,11 +16,31 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
|
})
|
|
})
|
|
export class WriteTweetPage {
|
|
export class WriteTweetPage {
|
|
|
|
|
|
- constructor(public navCtrl: NavController, public navParams: NavParams) {
|
|
|
|
|
|
+ tweet: FormGroup;
|
|
|
|
+
|
|
|
|
+ constructor(
|
|
|
|
+ public navCtrl: NavController,
|
|
|
|
+ public navParams: NavParams,
|
|
|
|
+ private formBuilder: FormBuilder
|
|
|
|
+ ) {
|
|
|
|
+ this.tweet = this.formBuilder.group({
|
|
|
|
+ text: ['', Validators.maxLength(140)]
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
ionViewDidLoad() {
|
|
ionViewDidLoad() {
|
|
- console.log('ionViewDidLoad WriteTweetPage');
|
|
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ get tweetCharProgress() {
|
|
|
|
+ let progress = 1 - this.tweet.value["text"].length/140;
|
|
|
|
+ let radius = 8;
|
|
|
|
+ let circumference = Math.PI * radius * 2;
|
|
|
|
+ return progress * circumference;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ logForm() {
|
|
|
|
+ console.log(this.tweet);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|