This is a migrated thread and some comments may be shown as answers.

Angular controler in remote view not initialized

1 Answer 79 Views
Integration with other JS libraries
This is a migrated thread and some comments may be shown as answers.
Matthias
Top achievements
Rank 1
Matthias asked on 16 Mar 2016, 01:11 PM

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?

1 Answer, 1 is accepted

Sort by
0
Matthias
Top achievements
Rank 1
answered on 16 Mar 2016, 05:47 PM

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.

 

Tags
Integration with other JS libraries
Asked by
Matthias
Top achievements
Rank 1
Answers by
Matthias
Top achievements
Rank 1
Share this question
or