how to trim the file name when length more than 10 in angular
<script src="js/jquery.js"></script>
<script>
$(document).ready(function(){
$('.uploadFilesItemHeader').find('#fileName').each(function() {
var fileNames = this.innerText;
var leftRightStrings = fileNames.split('.');
//file name
var fName = leftRightStrings[0];
//file extension
var fExtention = leftRightStrings[1];
var lengthFname = fName.length;
//if file name without extension contains more than 15 characters
if(lengthFname > 15){
$(this).html(fName.substr(0,10) + "..." + fName.substr(-5) + "." +fExtention);
}
});
});
<script>