What is the proper way to access a window from and Angular Controller

6 posts, 0 answers
  1. Kelly
    Kelly avatar
    28 posts
    Member since:
    Oct 2012

    Posted 15 Oct 2014 Link to this post

    I have a window that I'd like to toggle open and closed from a controller but since kendo creates it's windows outside of the body tag I cannot reference it using $scope.myWindow. What is the best way to access this window from a controller?
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 16 Oct 2014 Link to this post

    Hello Kelly,

    See this Dojo snippet for a demo of referencing the window from a scope method.

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Kelly
    Kelly avatar
    28 posts
    Member since:
    Oct 2012

    Posted 16 Oct 2014 in reply to Alex Gyoshev Link to this post

    Does this work when you include a window with ng-include or if you are trying to call a window from an included html snippet?

    Examples:

    1.
    <ng-controller>

    <open window command />
    <ng-include "window" />

    </ng-controller>


    2.
    <ng-controller>

    <ng-include "window open inside this code" />
    <window />

    </ng-controller>








  5. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 17 Oct 2014 Link to this post

    Hello Kelly,

    A more appropriate way to achieve this would be to have a hollow window around the ng-include. This way the open button will not trust blindly that the include includes the window, and the include will contain only the inner logic. Placing the window in an ng-include might register it in a child scope, thus it will be unavailable to outside widgets.

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. asd
    asd avatar
    10 posts
    Member since:
    Oct 2014

    Posted 11 Nov 2014 in reply to Alex Gyoshev Link to this post

    Is there a possibility to make it work using ng-include? Iam asking because I would like to have 2 views:
    First with grid and data
    Second with kendo window that opens whenever I add/edit grid row.
    In second view I want to define what fields are present in window and whats the width and heght of that window. ( using k-content: {url: ...} is not a option for my case )
  7. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 12 Nov 2014 Link to this post

    No, using a ng-include creates another scope, so the window is not usable in the controller. Use one of the solutions outlined in the thread.

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready