I have to read local text file which contains some data I need to extract some specific data from it but when I am using
it is reading and displaying whole file in HTML.
What exactly do you mean by local? On the client, or on the server?
Anyway, since the code you posted has access to the file, I guess it's on the server, so you can use
$http.get('filedta.txt').then(function(data) {
//use the file data here
});
<input type='file' />. For more information, see MDN Developer Reference - Using files from web applications.