Skip to content

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 &#8…

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