Skip to content
Advertisement

Tag: angularjs

How to get the last record in an array in AngularJS

I have an array of objects ObjectsArr= [Object1 , Object2,Object3, Object4] I want to show in my view the last object, how to do that in angularjs? Answer ObjectsArr[ObjectsArr.length – 1] — this will give you the last element in the array. To display it in view: {{ObjectsArr[ObjectsArr.length – 1]}} This will work even when the array has zero entries.

Render PDF using PDF.JS and AngularJS from byte array

I’ve been following the following links to try to render a byte stream returned from an API to a PDF in browser using PDF.JS: http://codingcrazy87.blogspot.com/2014/05/view-pdf-files-directly-within-browser.html https://gist.github.com/fcingolani/3300351 Here is the JavaScript used to run render. Note: stream is a byte array returned from an API. Here is $scope.renderPDF: Here is the HTML in my template page: When the code runs I

How to validate input number length with angular?

I want to validate a 9 digits number using angular, this is in my modal : i tried pattern = [0-9]{9}, seems its passing every number that its getting . I want to pass only number 000000000 – 9999999999 , min-max also not working for me. this is what my app adding to this class: thank u ! Answer Have

Advertisement