Why do I need $parent to enable the function in ng-click when using ion-scroll?

后端 未结 2 2003
北荒
北荒 2020-12-17 05:46

I am using the following versions:

  1. Ionic, v1.0.0-beta.14
  2. AngularJS v1.3.6

Route configuration:

myApp         


        
2条回答
  •  半阙折子戏
    2020-12-17 06:11

    This is a very typical angular scoping issue. Ion-view creates a new child scope and uses prototypical inheritance: https://github.com/angular/angular.js/wiki/Understanding-Scopes

    Three are several ways to solve:

    • always use a dot: https://egghead.io/lessons/angularjs-the-dot
    • use the 'controller as' syntax: http://www.johnpapa.net/angularjss-controller-as-and-the-vm-variable/

提交回复
热议问题