如何在apache cordova visual studio 2015中使用angular.js [英] How to use angular.js in apache cordova visual studio 2015

查看:81
本文介绍了如何在apache cordova visual studio 2015中使用angular.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单代码不起作用。

Index.html

Simple code is not working.
Index.html

<!DOCTYPE html>
<html>
<head>    
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    
    <title>ESavdoMobile</title>

    <!-- ESavdoMobile references -->
    <link href="css/index.css" rel="stylesheet" />
</head>
<body>        
    <div ng-app="myApp" ng-controller="myCtrl">
       <button ng-click="count = count + 1">Click me!</button>
        <p>{{ count }}</p>

    </div>

        <!-- Cordova reference, this is added to your app when it's built. -->
        <script src="cordova.js"></script>
        <script src="scripts/platformOverrides.js"></script>
        <script src="scripts/index.js"></script>        
        <script src="scripts/angular.min.js"></script>                
</body>
</html>



和我的Index.js


And my Index.js

(function () {
    "use strict";
    
    document.addEventListener( 'deviceready', onDeviceReady.bind( this ), false );

    function onDeviceReady() {
        // Handle the Cordova pause and resume events
        document.addEventListener( 'pause', onPause.bind( this ), false );
        document.addEventListener( 'resume', onResume.bind( this ), false );
        
        // TODO: Cordova has been loaded. Perform any initialization that requires Cordova here.  
        var app = angular.module('myApp', []);
        app.controller('myCtrl', function ($scope) {
            $scope.count = 0;
        });
    };

    function onPause() {
        // TODO: This application has been suspended. Save application state here.
    };

    function onResume() {
        // TODO: This application has been reactivated. Restore application state here.
    };
} )();

推荐答案

范围){


scope.count = 0 ;
});
};

function onPause(){
// TODO:此应用程序已被暂停。在此处保存申请状态。
};

function onResume(){
// TODO:此应用程序已重新激活。在此处恢复应用程序状态。
};
})();
scope.count = 0; }); }; function onPause() { // TODO: This application has been suspended. Save application state here. }; function onResume() { // TODO: This application has been reactivated. Restore application state here. }; } )();


这篇关于如何在apache cordova visual studio 2015中使用angular.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆