Not sure how to create and anchor to a div when typing in input box

Question!

I created an AngularJS application that filters a list under the input box when you type more than one character in the input box. This input box is toward the middle of the page and I would like it to jump to the top of the page when a user is typing into it. I'm not sure how to achieve this. I'm pretty new to jquery and Angular so any help would be greatly appreciated

By : Intrepid


Answers

try this

 $('html, body').animate({ scrollTop: 0 }, 'slow');

to go to the top of the page whenever user types watch for the event

$scope.watch('mg-model',function(val){
 };) 

and when val is null or empty take any div id inside textbox is wrapped and animate



I would create a directive for you input field. Something like this:

.directive('query', function() {
    return {
        restrict:"A",
        replace: true,
        template: "


This video can help you solving your question :)
By: admin