小编And*_*ian的帖子

AngularJS:$ rootScope:在ng-repeat中调用ng-style函数时出现infdig错误

我正在尝试在一些短语上构建动画,这些短语将显示在网站主页上,随机位置以及淡入淡出和翻译效果.

我会做到这一点使用NG风格属性的NG-重复里面的属性和设置NG-样式值调用HomeController的内部定义JavaScript函数.

使用此approch会导致angular抛出异常:$ rootScope:infdig error 10 $ digest()迭代达到.中止!观察者在最近5次迭代中被解雇

我读了很多关于这个,但没有解决方案解决了我的情况.有人可以帮帮我吗?

这是index.html的一部分:

<div class="phrasesContainer" animate-phrases="">
      <h3 class="flying-text" ng-repeat="phrase in Phrases" ng-style="getTopLeftPosition()">{{phrase}}</h3>
    </div>
Run Code Online (Sandbox Code Playgroud)

这是控制器功能:

$scope.getTopLeftPosition = function() {
var top = randomBetween(10, 90);
var left = getRandomTwoRange(5, 30, 70, 80);

return {
  top: top + '%',
  left: left + '%'
};
Run Code Online (Sandbox Code Playgroud)

}

这是一个演示:http://plnkr.co/edit/8sYks589agtLbZCGJ08B?p = preview

javascript jquery angularjs ng-style angularjs-rootscope

8
推荐指数
1
解决办法
839
查看次数

播放来自 Service Worker 的声音

有没有办法播放服务人员的音频文件?

我正在尝试使用io.sound库,但它是一个需要window 的JavaScript 插件,因此它不起作用。

编辑

按照杰夫的建议,我正在尝试打开一个新窗口并向该窗口发布一条消息。这是我的代码:

function notifyClientToPlaySound() {
  idbKeyval.get('pageToOpenOnNotification')
    .then(url => {

        console.log("notifyClientToPlaySound", url);

        clients.matchAll({
            type: "window"
            //includeUncontrolled: true
        })
        .then((windowClients) => {

            console.log("notifyClientToPlaySound - windowClients", windowClients);
            for (var i = 0; i < windowClients.length; i++) {
                var client = windowClients[i];
                if (client.url === url && "focus" in client) {
                    notify({ event: "push" });
                    return client.focus();
                }
            }

            //https://developer.mozilla.org/en-US/docs/Web/API/Clients/openWindow
            if (clients.openWindow) {
                return clients.openWindow("/")
                    .then(() => {
                        notify({ event: "push" });
                    });
            }
        })
    }); …
Run Code Online (Sandbox Code Playgroud)

javascript audio service-worker

7
推荐指数
1
解决办法
1万
查看次数

针对com/google/android/gms/measurement/AppMeasurementService.class的TransformException重复条目

更新Android支持存储库后(不确定是否相关)我在运行我的应用程序进行调试时遇到此错误:

Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
    > com.android.build.api.transform.TransformException: java.util.zip.ZipException: 
    duplicate entry: com/google/android/gms/measurement/AppMeasurementService.class
Run Code Online (Sandbox Code Playgroud)

我读了许多关于类似异常的答案,但我找不到一个西装.

这些是我的库依赖项:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'

    compile "com.android.support:appcompat-v7:${supportLibVersion}"
    compile "com.android.support:support-v13:${supportLibVersion}"
    compile "com.android.support:design:${supportLibVersion}"
    compile "com.android.support:customtabs:${supportLibVersion}"

    compile "com.android.support:recyclerview-v7:${supportLibVersion}"

    compile 'com.bignerdranch.android:expandablerecyclerview:2.1.1'

    compile 'com.mikepenz:iconics-core:2.5.11@aar'
    compile 'com.mikepenz:google-material-typeface:2.2.0.1.original@aar'

    compile('com.github.afollestad.material-dialogs:core:0.8.5.8@aar') {
        transitive = true
    }
    compile('com.github.afollestad.material-dialogs:commons:0.8.5.8@aar') {
        transitive = true
    }

    compile "com.google.android.gms:play-services-maps:${playServicesLibVersion}"
    compile "com.google.android.gms:play-services-gcm:${playServicesLibVersion}"
    compile "com.google.android.gms:play-services-location:${playServicesLibVersion}"
    compile "com.google.android.gms:play-services-plus:${playServicesLibVersion}"
    compile "com.google.android.gms:play-services-auth:${playServicesLibVersion}"

    compile "com.google.firebase:firebase-core:${playServicesLibVersion}"
    compile "com.google.firebase:firebase-ads:${playServicesLibVersion}"
    compile "com.google.firebase:firebase-messaging:${playServicesLibVersion}"

    compile 'com.annimon:stream:1.0.8'

    compile 'org.apache.commons:commons-lang3:3.4'

    compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
    compile 'com.soundcloud.android:android-crop:1.0.1@aar'

    compile files('libs/azure/notificationhubs/notification-hubs-0.4.jar')
    compile files('libs/azure/notifications/notifications-1.0.1.jar')

    compile …
Run Code Online (Sandbox Code Playgroud)

dependencies android build android-gradle-plugin

5
推荐指数
0
解决办法
1164
查看次数

Android BOOT_COMPLETED权限拒绝

我想在运行Android 7.1.1的真实设备上测试启动接收器(android.intent.action.BOOT_COMPLETED),我尝试从命令提示符下使用以下命令:

adb shell正在广播-a android.intent.action.BOOT_COMPLETED -p [package_name]

但它会返回广告异常:

java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=11114, uid=2000
    at android.os.Parcel.readException(Parcel.java:1684)
    at android.os.Parcel.readException(Parcel.java:1637)
    at android.app.ActivityManagerProxy.broadcastIntent(ActivityManagerNative.java:3537)
    at com.android.commands.am.Am.sendBroadcast(Am.java:772)
    at com.android.commands.am.Am.onRun(Am.java:404)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
    at com.android.commands.am.Am.main(Am.java:121)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)
Run Code Online (Sandbox Code Playgroud)

我已经尝试过Android提供的解决方案-尝试在启动时测试服务(java.lang.SecurityException:权限拒绝),但是它对我不起作用。

我该如何解决?

提前致谢!:)

android broadcastreceiver android-intent bootcompleted

5
推荐指数
0
解决办法
2391
查看次数

Xamarin.iOS ZXing.Net.Mobile 条码扫描器

我正在尝试将条形码扫描仪功能添加到我的 xamarin.ios 应用程序中。我正在从 Visual Studio 进行开发,并添加了来自 xamarin 组件商店的 Zxing.Net.Mobile 组件。

我已经实现了它,如示例所示:

ScanButton.TouchUpInside += async (sender, e) => {
            //var options = new ZXing.Mobile.MobileBarcodeScanningOptions();
            //options.AutoRotate = false;
            //options.PossibleFormats = new List<ZXing.BarcodeFormat>() {
            //    ZXing.BarcodeFormat.EAN_8, ZXing.BarcodeFormat.EAN_13
            //};

            var scanner = new ZXing.Mobile.MobileBarcodeScanner(this);
            //scanner.TopText = "Hold camera up to barcode to scan";
            //scanner.BottomText = "Barcode will automatically scan";
            //scanner.UseCustomOverlay = false;
            scanner.FlashButtonText = "Flash";
            scanner.CancelButtonText = "Cancel";
            scanner.Torch(true);
            scanner.AutoFocus();

            var result = await scanner.Scan(true);
            HandleScanResult(result);
        };

void HandleScanResult(ZXing.Result result)
    {
        if (result != …
Run Code Online (Sandbox Code Playgroud)

barcode-scanner xamarin.ios zxing ios xamarin

3
推荐指数
1
解决办法
5265
查看次数

.NET Core 2 Web API:[FromBody] 嵌套对象未绑定

我的控制器中有该发布请求:

[HttpPost("subscriptions")]
[Authorize(Policy = Policies.Admin)]
public async Task<IActionResult> PostSubscription([FromBody] PostSubscriptionBindingModel model) { ... }
Run Code Online (Sandbox Code Playgroud)

哪里PostSubscriptionBindingModel

public class PostSubscriptionBindingModel
{
    [Required]
    public DateTime StartsOn { get; set; }
    [Required]
    public DateTime ExpiresOn { get; set; }
    [Required]
    public Gym Gyms { get; set; }
    [Required]
    public int SubscriptionTypeId { get; set; }
    [Required]
    public string UserId { get; set; }

    public PaymentBindingModel Payment { get; set; }

    public class PaymentBindingModel
    {
        [Required]
        public double Amount { get; internal set; …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc binding .net-core asp.net-core-webapi angular

2
推荐指数
1
解决办法
2521
查看次数