You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If not I am having a few issues so I think I will just paste my code and someone can tell me what I am doing wrong.
Pages Controller
// Import for forms and validations
import { FormGroup, FormControl, FormBuilder, Validators } from '@angular/forms';
declare var SirTrevor: any; // declared as any, so anything goes
@Component({
selector: 'app-pages',
templateUrl: './pages.component.html',
styleUrls: ['./pages.component.css']
})
export class PagesComponent implements OnInit, OnDestroy {
editor: any;
public pageForm: FormGroup; // our model driven form
constructor() {
SirTrevor.setDefaults({
iconUrl: "../assets/sirtrev/sir-trevor-icons.svg"
});
SirTrevor.setDefaults({
uploadUrl: "https://api.cloudinary.com/v1_1/property-roland/image/upload?upload_preset=n3fxornt",
attachmentName: 'name',
attachmentFile: 'file',
attachmentUid: 'uid'
});
}
ngOnInit() {
// Load initiail blank form group
this.pageForm = new FormGroup({
});
if(!this.editor) {
this.editor = new SirTrevor.Editor({
el: document.getElementById('sir-editor'),
defaultType: 'Text',
iconUrl: '../assets/sirtrev/sir-trevor-icons.svg'
});
}
}
ngOnDestroy() {
if(this.editor) {
this.editor.destroy();
this.editor = undefined;
}
}
getData() {
console.log(this.editor.store.retrieve());
console.log(this.editor.store.toString());
console.log(this.editor);
}
}
Pages View
<form [formGroup]="pageForm" (ngSubmit)="getData()" novalidate>
<textarea id="sir-editor"></textarea>
<button type="submit" class="btn btn-primary">Data</button>
</form>
The thing is that the data only shows when I click submit twice (weird). Then when I navigate away and come back it does not show any data on save after adding new content.
The text was updated successfully, but these errors were encountered:
Pages Controller
The thing is that the data only shows when I click submit twice (weird). Then when I navigate away and come back it does not show any data on save after adding new content.
The text was updated successfully, but these errors were encountered: