Suppose I have a component like this
app.component('test',{
template: '<input type="text" id="inputbox"></input>',
controller: function() {
ctrl.focusInput = function(){
var inputbox = document.getElementById("inputbox");
inputbox.focus();
}
};
}
});
I would like to get the DOM element for the input so I can focus it whenever I want. However inputbox falls in global scope which will be a problem if I use this component more than once. How can I get the DOM just for the input in this component - either by restricting scope of inputbox or using some other mechanism?
var inputboxline look like with your suggestion?