showFile() {
var fs = require('fs');
var obj = fs.readFile('dic.txt', 'utf8');
console.log(obj);
}
getItems(ev) {
// Reset items back to all of the items
this.initializeItems();
// set val to the value of the ev target
var val = ev.target.value;
// if the value is an empty string don't filter the items
if (val && val.trim() != '') {
this.items = this.items.filter((item) => {
this.showFile();
return (item.toLowerCase().indexOf(val.toLowerCase()) > -1);
})
}
}
I want to make a mobile application as a dictionary. I have a text file that store all the words in Russian with a translation in English. I need to make a search from this file, when to enter words and need to show the translation. I am writing code on Ionic 3. I have error: fs.readFile is not a function.(In 'fs.readFile('dic.txt','utf8')','fs.readFile' is undefined)