ngCordova Barkod Tarayıcısını kullanma Barkod numarasını ve barkod formatını değişkenleri değişkenler halinde depolayarak bunları uygulama görünümünde gösteriyorum. Yeni barkod numarası ve formatını her yazışımda saklanan değişkeni güncellemek zorunda olan birden fazla barkodu tarayamıyorum. Ancak birden fazla barkodu taradığımda, yerine "Barkod: + barkodNumarası" eklemeye devam ediyor. Neyi yanlış yaptığımı anlayamıyorum. Uygulama ekran görüntüsü sorunu gösterir.AngularJS kullanarak angularJS kullanarak değişkenleri yazma problemleri İyonic
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="js/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
</head>
<body ng-app="starter">
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Barcode Scanner</h1>
</ion-header-bar>
<ion-content ng-controller="barcodeController">
<button class="button button-full button-positive" ng-click="scanBarcode()">
Scan Now
</button>
<div class="card">
<div class="item item-divider">Barcode Data</div>
<div class="item item-text-wrap">Barcode: {{barcodeNumber}}</div>
<div class="item item-text-wrap">Format: {{barcodeFormat}}</div>
</div>
</ion-content>
</ion-pane>
</body>
</html>
İşte
benim app.js kod oluyor: bu çıktı bu hata/bug sonucu Yani
// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
var ionScanner = angular.module('starter', ['ionic', 'ngCordova'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
// Don't remove this line unless you know what you are doing. It stops the viewport
// from snapping when text inputs are focused. Ionic handles this internally for
// a much nicer keyboard experience.
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
ionScanner.controller("barcodeController", function($scope, $cordovaBarcodeScanner) {
$scope.scanBarcode = function() {
$cordovaBarcodeScanner.scan().then(function(barcodeData){
if (barcodeData.cancelled == 1){
// Do nothing
}else{
// Assign barcode data
$scope.barcodeNumber = "";
$scope.barcodeNumber = barcodeData.text;
$scope.barcodeFormat = barcodeData.format;
}
}, function(error){
console.log("Error: " + error);
});
}
});
Projenizi yeniden ürettim ... bu garip ... Android üzerinde mükemmel çalışıyor. Birkaç şeyi değiştirdim, ama onu iOs üzerinde çalışamıyorum. Umarım, birisi bunu çözebilir :) özellikle tuhaftır, çünkü sadece değişken tekrarlanır, fakat bütün "Barkod: ..." ifadesi tekrarlanır mı ?! –
Bu çok garip, ne denediğimin bir önemi yok, her zaman aynı garip hatayla bitiyor ... – Webinno