i have html page on this page i want to pass the value of ng-model as a parameter to ng-mousedown :-
<ng-model ng-mousedown="check(ctrl.selectedPeople)">
And i have an js file with respect to html file where i write angular code in this file i have a function that is CHECK(searchtext) , i want to call it on mousedown event but i getting searchtext parameter as undefined ,
'use strict';
var app = angular.module('demo', ['ngSanitize', 'ui.select']);
app.filter('propsFilter', function () {
return function (items, props) {
var out = [];
if (angular.isArray(items)) {
var keys = Object.keys(props);
items.forEach(function (item) {
var itemMatches = false;
for (var i = 0; i < keys.length; i++) {
var prop = keys[i];
var text = props[prop].toLowerCase();
if (item[prop].toString().toLowerCase().indexOf(text) !== -1) {
itemMatches = true;
break;
}
}
if (itemMatches) {
out.push(item);
}
});
} else {
out = items;
}
return out;
};
});
app.controller('DemoCtrl', function ($scope) {
var result = this;
result.tagTransform = function (newTag) {
var item = {
name: newTag
};
return item;
};
var arr = [];
var arr = [
{
"name": "TCS",
"Access": "TATA"
},
{
"name": "GG",
"Access": "GOOGLE"
},
{
"name": "MS",
"Access": "Micosoft"
}
];
result.people = arr;
result.colors = ['Blue', 'Red'];
result.selectedPeople2 = result.selectedPeople;
$scope.check = function (searchText) {
debugger;
var Forsecond="";
var ff = searchText[0];
var dd = ff.name;
if(dd==ff.name)
{
Forsecond= ff.Access;
}
return Forsecond;
}
});
What I have tried:
i have html page on this page i want to pass the value of ng-model as a parameter to ng-mousedown :-
<ng-model ng-mousedown="check(ctrl.selectedPeople)">
And i have an js file with respect to html file where i write angular code in this file i have a function that is CHECK(searchtext) , i want to call it on mousedown event but i getting searchtext parameter as undefined ,
'use strict';
var app = angular.module('demo', ['ngSanitize', 'ui.select']);
app.filter('propsFilter', function () {
return function (items, props) {
var out = [];
if (angular.isArray(items)) {
var keys = Object.keys(props);
items.forEach(function (item) {
var itemMatches = false;
for (var i = 0; i < keys.length; i++) {
var prop = keys[i];
var text = props[prop].toLowerCase();
if (item[prop].toString().toLowerCase().indexOf(text) !== -1) {
itemMatches = true;
break;
}
}
if (itemMatches) {
out.push(item);
}
});
} else {
out = items;
}
return out;
};
});
app.controller('DemoCtrl', function ($scope) {
var result = this;
result.tagTransform = function (newTag) {
var item = {
name: newTag
};
return item;
};
var arr = [];
var arr = [
{
"name": "TCS",
"Access": "TATA"
},
{
"name": "GG",
"Access": "GOOGLE"
},
{
"name": "MS",
"Access": "Micosoft"
}
];
result.people = arr;
result.colors = ['Blue', 'Red'];
result.selectedPeople2 = result.selectedPeople;
$scope.check = function (searchText) {
debugger;
var Forsecond="";
var ff = searchText[0];
var dd = ff.name;
if(dd==ff.name)
{
Forsecond= ff.Access;
}
return Forsecond;
}
});