Monaca Onsen UI Discord Chat Github Repo

How to accessing the input value of <ons-search-input ></ons-search-input>

  • Hello Developers,

    Please I have been trying to access the value that is put in the input of this search element (<ons-search-input placeholder=“Search”></ons-search-input>). How do I access it please?

    The view

    <ons-page ng-controller="SearchController as search">
            <div class="left"><ons-back-button ng-click="splitter.load('home.html')"></ons-back-button></div>
            <div class="center">Search</div>
        <p style="text-align: center; margin-top: 120px">
            <ons-search-input  ng-keyup="search.takeaction()"></ons-search-input>

    Here is the controller

    var module = angular.module('my-app', ['onsen','ngSanitize']);
        module.controller('SearchController', function($http, $scope) {
        console.log('we got the search');
     this.takeaction = function(value)
         alert('fxn called');
         var searchkey = this.value;

    This displays ‘undefined’ for console.log(searchkey); on the view when the function is called. Someone should help me out please. Thanks in advance