科尔多瓦应用程序显示空白页

时间:2015-10-04 00:27:02

标签: javascript cordova

我想借助把手 javascript库,使用单个页面开发具有多个视图的cordova应用程序。我创建了一个名为MyFirstApp的带有phonegap的简单应用程序,然后编辑 www 目录下的 index.html 文件。但是当我在互联网浏览器中运行应用程序时,没有显示有人看到我做错了吗?

的index.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Hello World</title>



    </head>
    <body>

        <div class="mainpage">
            <!--This is our template. -->
            <!--Data will be inserted in its according place, replacing the brackets.-->
            <script id="address-template" type="text/x-handlebars-template">
              <p>You can find me in {{city}}. My address is {{number}} {{street}}.</p>
            </script>

            <!--Your new content will be displayed in here-->
            <div class="content-placeholder"></div>
        </div>
        <script src="js/jquery-2.1.4.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="js/handlebars-v4.0.2.js"></script>
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>

        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
</html>

index.js

    var app = {
    initialize: function() {
        this.bindEvents();
    },bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },onDeviceReady: function() {
        // Grab the template script
      var theTemplateScript = $("#address-template").html();

      // Compile the template
      var theTemplate = Handlebars.compile(theTemplateScript);

      // Define our data object
      var context={
        "city": "London",
        "street": "Baker Street",
        "number": "221B"
      };

      // Pass our data to the template
      var theCompiledHtml = theTemplate(context);

      // Add the compiled html to the page
      $('.content-placeholder').html(theCompiledHtml);
    }
};

1 个答案:

答案 0 :(得分:0)

将此作为index.js:

var identity = new ClaimsIdentity(context.Options.AuthenticationType);

var props = new AuthenticationProperties(new Dictionary<string, string>
{
    { "UserName", customer.FirstName }, { "Id", customer.Id.ToString() } 
});