valnub / Framework7-Pure-Angular-Template

⛔️ Unmaintained and deprecated! Don't use any more! Instead check official F7 templates: http://framework7.io/templates/
MIT License
71 stars 35 forks source link

Not working in device #8

Closed ashokkumar88 closed 8 years ago

ashokkumar88 commented 8 years ago

Hi, The blank template is working fine in local server. but when building it with cordova, the html is rendering but when I am clicking on any link nothing happens. No error in console.

valnub commented 8 years ago

Hey, you have to make 100% sure that Cordova's "deviceready" event is fired. If it doesn't the template/app won't work. Usually this is a problem if cordova.js is not properly included in html, so double check if you added this manually:

<script type="text/javascript" src="cordova.js"></script>
ashokkumar88 commented 8 years ago

omg! I forgot to add cordova.js. It is working fine now. Thanks very much valnub. You saved my day.

ashokkumar88 commented 8 years ago

should I assign the $scope variables this way?

MyApp.angular.controller('DetailPageController', ['$scope', '$http', 'InitService', function ($scope, $http, InitService) {
  'use strict';

  InitService.addEventListener('ready', function () {
    // DOM ready
    console.log('DetailPageController: ok, DOM ready');
    $scope.test = 'testing';
    // You can access angular like this:
    // MyApp.angular

    // And you can access Framework7 like this:
    // MyApp.fw7.app
  });

}]);
valnub commented 8 years ago

Yeah, looks good

ashokkumar88 commented 8 years ago

But the $scope value is not showing in the view.

valnub commented 8 years ago

You need to set scope variables outside of the ready function:

MyApp.angular.controller('DetailPageController', ['$scope', '$http', 'InitService', function ($scope, $http, InitService) {
  'use strict';

  $scope.test = 'testing';

  InitService.addEventListener('ready', function () {
    // DOM ready
    console.log('DetailPageController: ok, DOM ready');
    // You can access angular like this:
    // MyApp.angular

    // And you can access Framework7 like this:
    // MyApp.fw7.app
  });

}]);
ashokkumar88 commented 8 years ago

yeah! working fine. Thanks a lot.

valnub commented 8 years ago

You're welcome :)

ashokkumar88 commented 8 years ago

I have almost completed a app using Onsen UI. Now I am thinking to switch to F7. Do you think that using F7 with Angular degrade the performance compare to without Angular?

valnub commented 8 years ago

Possible but not certain. Angular is not very well known for its performance. I don't know about Angular2 though, you might want to look into that.

ashokkumar88 commented 8 years ago

ok. thanks