I'm trying to use this AngularJS material chip. (CONTACT CHIP - With auto-complete) https://material.angularjs.org/latest/demo/chips
And it has a different structure of what I'm used to. I want to adapt to get the contacts from my mongodb with $http, like:
$http.get("/contacts").success(function(response) {
contacts = response;
});
But in their Angular Material code example is like this:
angular.module('MyApp',['ngMaterial', 'ngMessages', 'material.svgAssetsCache'])
.controller('ContactChipDemoCtrl', DemoCtrl);
function DemoCtrl ($q, $timeout) {
...
function loadContacts() {
var contacts = [
'Marina Augustine',
'Oddr Sarno',
'Nick Giannopoulos',
'Narayana Garner',
'Anita Gros',
'Megan Smith',
'Tsvetko Metzger',
'Hector Simek',
'Some-guy withalongalastaname'
];
}
...
How can I use $http as a parameter for the DemoCtrl function? To get the contacts from db