AngularJS Scope - Chrome应用程序

时间:2015-05-31 04:06:10

标签: angularjs angularjs-scope google-chrome-app

我用来创建Chrome应用的Angular JS的新功能。

任何人都知道如何在chillax.breakInterval回调函数中访问chrome.storage.sync.get(以及“chillax”的其他属性)?

angular.module('ChillaxApp', [])
    .controller("ChillaxController", function () {

    var chillax = this;

    chillax.init = function() {
        var settings = {};

        settings["enabled"] = "";
        settings["reminderInterval"] = "";
        settings["breakInterval"] = "";
        settings["sound"] = "";

        chrome.storage.sync.get(settings, function(obj) {
            // Setting these variables here aren't available within the controller
            chillax.reminderInterval = obj["reminderInterval"];
            chillax.breakInterval = obj["breakInterval"];
            chillax.sound = obj["sound"];
        });
    };

0 个答案:

没有答案