Based on the tabs demo and chat param.
I want to show user based on there id.
i do not understand this ID things, Should it absolutly be 0,1,2,3,4,5…???
If it begin with any number. 9 for this exemple it do not work.
var smss = [{
id: '9',
name: 'Ben Sparrow',
lastText: 'You on your way?',
face: 'img/ben.png',
phone: '4181231234'
}, {
id: '1',
name: 'Max Lynx',
lastText: 'Hey, it\'s me',
face: 'img/max.png'
}, {
id: '2',
name: 'Adam Bradleyson',
lastText: 'I should buy a boat',
face: 'img/adam.jpg'
}
it’s only work if the id number is in order begining by 0.
angular.forEach(smss, function (value, key) {
console.log(value.id);
if (value.id === smsId)
return smss[smsId];
});
OR
smss.forEach(function (sms) {
if (sms.id === smsId) {
console.log(sms.id)
console.log(smss[smsId])
return smss[smsId];
}
})
What i really want, is that the ID will be the user phone number.
id: ‘123-123-1234’,
I do not understand why the id should absolutly be 0,1,2,3,4 ect…