Get an object from array which contains a specific value

Use _.find instead of findWhere: console.log(_.find(response.data, function(item) { return item.TaskCategory.TaskCategoryId == $routeParams.TaskCategory; })); They are similar, but findWhere is designed for special cases where you want to match key-value pairs (not useful in your scenario as it involves nested objects). Find is more general-use, because it lets you provide a function as the predicate.

Filtering object properties based on value

Here are two vanilla javascript options: A.: Iterate over the object’s keys and delete those having a falsey value. var obj = { propA: true, propB: true, propC: false, propD: true, }; Object.keys(obj).forEach(key => { if (!obj[key]) delete obj[key]; }); console.log(obj); See Object.keys() and Array.prototype.forEach() B.: Iterate over the object’s keys and add truthy values … Read more

Sublime Text 2 recognize underscore templates as HTML

Go to “Browse Packages” in the menu (where the menu item is depends on your platform). Open up HTML/HTML.tmLanguage Change this line (line 286 in my HTML.tmLanguage): <string>(?:^\s+)?(&lt;)((?i:script))\b(?![^&gt;]*/&gt;)</string> to this: <string>(?:^\s+)?(&lt;)((?i:script))\b(?![^&gt;]*/&gt;)(?!.*type=[“‘]text/template[‘”])</string> Now any script tags with type=”text/template” or type=”text/template” will render as html and not javascript.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)