Angular controler in remote view not initialized

2 posts, 0 answers
  1. Matthias
    Matthias avatar
    3 posts
    Member since:
    Mar 2014

    Posted 16 Mar Link to this post

    Hi,

    VS 2015, Cordova, Kendo UI Core v2015.3.930, AngularJS v1.5.0, ngCordova v0.1.23-alpha

    I'm trying to get a drawer working with remote views, but my angular controller bound to app/views/settings.html won't fire:

    index.html:

        <!-- application drawer and contents -->
        <div data-role="drawer" id="appDrawer" style="width: 270px" data-title="Navigation" data-ng-controller="drawerController as vm">
            <div data-role="header">
                <div data-role="navbar">
                    <span data-role="view-title"></span>
                </div>
            </div>
            <ul data-role="listview">
                <li>
                    <a href="app/views/settings.html">Remote Settings</a>
                </li>
                <li><a href="#internSettings">Intern Settings</a></li>
            </ul>
        </div>

    <div data-role="view" data-title="InternSettings" data-layout="main" id="internSettings" data-ng-controller="settingsController as vm">
      <h1 data-bind="html: title"></h1>
        <h1>{{vm.helloMsg}}</h1>
    </div>

    app/views/settings.html:

    <div data-role="view" data-title="Settings" data-layout="main" data-ng-controller="settingsController as vm">
      <h1 data-bind="html: title"></h1>
        <h1>{{vm.helloMsg}}</h1>
    </div>

    settingsController.js:

    (function () {
        'use strict';

        function settingsController() {
            this.helloMsg = "Hello settingsController";
        }
        angular.module("iEmosApp.controllers").controller('settingsController', [settingsController]);
    })();

    When clicking on "Intern Settings" (using the view inside index.html), I see "Hello settingsController", so Angular is working.

    But when clicking "Remote Settings" (using the remote view) I only see "{{vm.helloMsg}}"

    How can I get the Angular controller to work in remote views?

  2. Matthias
    Matthias avatar
    3 posts
    Member since:
    Mar 2014

    Posted 16 Mar in reply to Matthias Link to this post

    Never mind, found th esolution,: I have to use the <k-mobile-view>-tags instead of  <div data-role="view"...

    1.<p><kendo-mobile-view id="settings" k-title="'Settings'" k-layout="'main'" ng-controller="settingsController as vm"><br>    <h1>{{vm.helloMsg}}</h1><br>    <h3>ddfkj</h3><br></kendo-mobile-view></p><p></p>

    The above works as remote view.

     

  3. UI for ASP.NET AJAX banner
Back to Top