Select All Text on Focus AngularJS

3 posts, 0 answers
  1. Marc
    Marc avatar
    161 posts
    Member since:
    Sep 2016

    Posted 16 Feb Link to this post

    The details here, do not seem to work for AngularJS implementation. Nothing happens, and none of my log messages are shown on click or focus.

    http://docs.telerik.com/kendo-ui/controls/editors/numerictextbox/how-to/select-all-on-focus

    My Html:

    <input kendo-numeric-text-box
    k-min="0"
    k-ng-model="params.averagePrice.max"
    style="width: 45%;"
    k-format="'n1'"
    k-step="0.1"
    k-on-change="maxChange(params.averagePrice)"
    k-on-spin="maxChange(params.averagePrice)"/>

     

    Inside my Angularjs Controller:

    $(document).ready(function () {
    $("input[type=text]").bind("focus", function () {
    $log.info("bind focus ");
    var input = $(this);
    clearTimeout(input.data("selectTimeId")); //stop started time out if any

    var selectTimeId = setTimeout(function () {
    input.select();
    });

    input.data("selectTimeId", selectTimeId);
    }).blur(function (e) {
    $log.info("bind blur");
    clearTimeout($(this).data("selectTimeId")); //stop started timeout
    })
    });

  2. Ianko
    Admin
    Ianko avatar
    1729 posts

    Posted 20 Feb Link to this post

    Hello Marc,

    With AngularJS, you should rather use the global kendoWidgetCreated event to interact with widgets on initialization.

    http://dojo.telerik.com/uXogi 

    Regards,
    Ianko
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Marc
    Marc avatar
    161 posts
    Member since:
    Sep 2016

    Posted 21 Feb in reply to Ianko Link to this post

    Hi Ianko,

    I had done that, but still had some issues. In the end, I believe my issue was due to the architecture of my page. (I have numerous Angular directives which had the multiselects inside , and I wanted to clear these multiselects from outside those directives). I used a watch inside each directive and got it to work that way.

    Thanks for the help though!

    Marc

Back to Top