Operating Environment:
- Eclipse 4.4.2,
- IBM MobileFirst Platform Foundation 7.1,
- StarterApplication_ionic-release71.zip,
- angular-route.js [AngularJS v1.2.12 part of sample application] and
- ionic.bundle.js [Ionic, v1.0.0-beta.1 part of sample application]
The StarterApplication_ionic-release71.zip has been successfully imported into the existing Eclipse workspace.
Within feeds.html
<button data-ng-click="clickMe()">Click Me!</button>
In the controllers.js file under the Scope of FeedsController
$scope.clickMe = function(){
alert("123");
console.log("I am clicked");
};
Complete code snippet:
app.controller('FeedsController', function($rootScope, $scope, feedsService,
$ionicLoading, $timeout) {
$scope.clickMe = function(){
alert("123");
console.log("I am clicked");
};
$scope.loading = $ionicLoading.show({
content: '<i class="ion-loading-c"></i> Loading...',
animation: 'fade-in',
showBackdrop: true,
maxWidth: 200,
showDelay: 0
});
$scope.getFeeds = function() {
$rootScope.feeds = [];
$scope.errorMsg = "";
feedsService().then(function (feeds) {
$rootScope.feeds = feeds;
$scope.$broadcast('scroll.refreshComplete');
$scope.errorMsg = "";
$scope.loading.hide();
},
function(error) {
$scope.errorMsg = "Could Not Load feeds";
$scope.$broadcast('scroll.refreshComplete');
$scope.loading.hide();
});
};
$scope.getFeeds();
});
The html and js codes have been added as specified above.
Upon clicking the button, the clickMe method seems to be triggered twice, resulting in the alert being displayed twice along with double logging.
Attempts were made to investigate the root cause using Google search and StackOverflow but unfortunately, the source of this issue remains unidentified...