控制器功能切换到安卓应用程序AngularJS中的新html页面



我的index.html文件(续):

 <body background="imgloginback.jpg" ng-controller="SignInCtrl" >  <button ng-click='signIn()'>SignUp</button> </body>

我的app.js包含:

angular.module("Status Logger",["onic"]).controller("SignInCtrl",函数($scope,$location){$scope.signIn=函数(){$location.path('home.html');};})

但是home.html并没有被调用。请帮帮我,我哪里做错了。

提前谢谢。

使用$apply()。使用以下代码重试:

HTML

<div ng-app ng-controller="SignInCtrl">   
    <button ng-click="signIn()">SignUp</button>
</div>

JS

function SignInCtrl($scope, $location) {
    $scope.signIn = function() {
        $scope.$apply( $location.path( 'http://google.com' ) );
    };  
}

我希望能帮助你。

希望这将有助于

HTML

<body ng-app="StatusLogger" ng-controller="SignInCtrl">   
    <button ng-click="signIn()">SignUp</button>
</body>

控制器

angular.module('StatusLogger', ['ionic'])
    .controller('SignInCtrl', function ($scope, $location) {
        $scope.signIn = function () {
            $location.path('home.html');
        };
    });