angularjs-ionicframework-点击一行

angularjs-ionicframework-点击一行,angularjs,ionic-framework,Angularjs,Ionic Framework,我需要打开一个新的页面时,一个项目是触摸,但我不能使它的工作,我不知道为什么 这是我的html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width

我需要打开一个新的页面时,一个项目是触摸,但我不能使它的工作,我不知道为什么

这是我的html:

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

        <link href="lib/ionic/css/ionic.css" rel="stylesheet">
        <link href="css/style.css" rel="stylesheet">

        <!-- ionic/angularjs js -->
        <script src="lib/ionic/js/ionic.bundle.js"></script>

        <!-- cordova script (this will be a 404 during development) -->
        <script src="cordova.js"></script>

        <!-- your app's js -->
        <script src="js/app.js"></script>
    </head>

    <body ng-app="starter" ng-controller="ClientsCtrl">

        <ion-pane>
            <ion-header-bar class="bar-stable">
                <h1 class="title">Elenco Clienti</h1>
            </ion-header-bar>

            <ion-content>
                <label class="item item-input">
                    <i class="icon ion-search placeholder-icon"></i>
                    <input type="search" placeholder="Cerca" ng-model="query[queryBy]">
                </label>
                <ion-list>
                    <ion-item ng-repeat="client in clients | filter:query" href="#/app/clients/{{ client.name }}">

                        <!-- <div class="row" on-hold="showActionsheet(client)"> -->
                            {{ client.name }}
                        <!-- </div> -->

                    </ion-item>
                </ion-list>
            </ion-content>

        </ion-pane>

        <div class="bar bar-footer bar-positive">
            <div class="title">
                <button class="button button-icon" ng-click="newClient()">
                    Aggiungi cliente <i class="icon ion-compose"></i>
                </button>
            </div>
        </div>

        <script id="new-client.html" type="text/ng-template">

            <div class="modal">

                <!-- Modal header bar -->
                <ion-header-bar class="bar-secondary">
                    <h1 class="title">Nuovo Cliente</h1>
                    <button class="button button-clear button-positive" ng-click="closeNewClient()">Annulla</button>
                </ion-header-bar>

                <!-- Modal content area -->
                <ion-content>

                    <form ng-submit="createClient(client)">
                        <div class="list">
                            <label class="item item-input">
                                <span class="input-label">Nome:</span>
                                <input type="text" ng-model="client.name">
                            </label>
                            <label class="item item-input">
                                <span class="input-label">Numero:</span> 
                                <input type="tel" ng-model="client.phone">
                            </label>
                        </div>
                        <div class="padding">
                            <button type="submit" class="button button-block button-positive">Inserisci cliente</button>
                        </div>
                    </form>

                </ion-content>

            </div>

        </script>

    </body>
</html>

埃伦科克利恩蒂酒店
{{client.name}
Aggiungi客户
新客户
环
诺姆:
数字:
Inserisci客户
这是我的app.js

// Clients App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic'])

    /* Costruttore */   
    .factory('Clients', function(){
        return{
            all: function(){

                //Recupero tutti i clienti
                var clientsString = window.localStorage['clients'];

                //Se ci sono dati
                if( clientsString ){
                    //Restituisco i dati
                    return angular.fromJson(clientsString); 
                }               

                //Non c'è nulla
                return [];
            },
            save: function(clients){
                window.localStorage['clients'] = angular.toJson(clients);
            },
        }
    })

    .config(function($stateProvider, $urlRouterProvider) {
      $stateProvider

        .state('app.single', {
          url: "/clients/:clientName",
          views: {
            'menuContent' :{
              templateUrl: "templates/client.html",
              controller: 'SingleCtrl'
            }
          }
        });
    })

    .controller('ClientsCtrl', function($scope,  $ionicModal, Clients, $ionicActionSheet){

        $scope.query = {}
        $scope.queryBy = 'name'

        // Load or initialize projects
        $scope.clients = Clients.all();

        $scope.orderProp="name"; 

        // Create and load the Modal
        $ionicModal.fromTemplateUrl('new-client.html', function(modal) {
                $scope.clientModal = modal;
            }, 
            {
                scope: $scope,
                animation: 'slide-in-up'
            }
        );

        // Called when the form is submitted
        $scope.createClient = function(client) {
            $scope.clients.push({
              name: client.name,
              phone: client.phone,
              data: new Date()
            });
            $scope.clientModal.hide();
            client.name = "";
            client.phone = "";
            Clients.save($scope.clients);
          };

          // Open our new task modal
          $scope.newClient = function() {
              $scope.clientModal.show();
          };

          $scope.closeNewClient = function() {
              $scope.clientModal.hide();
         };


         $scope.showActionsheet = function(client){

            $ionicActionSheet.show({
                titleText: 'Azioni',
                buttons: [
                    { text: 'Cancella selezionato' },
                ],

                destructiveText: 'Cancella tutto <i class="icon ion-trash-a"></i>',
                cancelText: 'Annulla',

                buttonClicked: function(index) {

                    if( index == 0 )
                    {                   
                        //E' una delete
                        $scope.clients.splice( $scope.clients.indexOf(bet), 1 );
                        Clients.save($scope.clients);
                    }

                    return true;
                },

                //Cancella tutto
                destructiveButtonClicked: function() {

                    //Libero L'array
                    $scope.clients = [];                    
                    Clients.save($scope.clients);

                    return true;
                }
            });
        };
})

.controller('SingleCtrl', function($scope, $stateParams) {
})
//客户端应用程序
//angular.module是创建、注册和检索angular模块的全局位置
//“starter”是此角度模块的名称
//第二个参数是“requires”的数组
角度模块('starter',['IONAL']))
/*科斯特鲁托尔*/
.factory('客户端',函数()){
返回{
全部:函数(){
//我的客户
var clientsString=window.localStorage['clients'];
//索诺达蒂酒店
如果(客户端字符串){
//达蒂疗养院
返回angular.fromJson(clientsString);
}               
//非cènulla
返回[];
},
保存:功能(客户端){
window.localStorage['clients']=angular.toJson(客户端);
},
}
})
.config(函数($stateProvider,$urlRouterProvider){
$stateProvider
.state('app.single'{
url:“/clients/:clientName”,
观点:{
“菜单内容”:{
templateUrl:“templates/client.html”,
控制器:“SingleCtrl”
}
}
});
})
.controller('ClientsCtrl',函数($scope,$IonicModel,Clients,$ionicActionSheet){
$scope.query={}
$scope.queryBy='name'
//加载或初始化项目
$scope.clients=clients.all();
$scope.orderProp=“name”;
//创建并加载模态文件
$ionicModal.fromTemplateUrl('new-client.html',函数(模态){
$scope.clientModal=modal;
}, 
{
范围:$scope,
动画:“向上滑动”
}
);
//提交表单时调用
$scope.createClient=函数(客户端){
$scope.clients.push({
name:client.name,
电话:client.phone,
数据:新日期()
});
$scope.clientModal.hide();
client.name=“”;
client.phone=“”;
保存($scope.Clients);
};
//打开我们的新任务模式
$scope.newClient=函数(){
$scope.clientModal.show();
};
$scope.closeNewClient=函数(){
$scope.clientModal.hide();
};
$scope.showActionsheet=功能(客户端){
$IoniActionSheet.show({
标题文字:“阿齐奥尼”,
按钮:[
{text:'Cancella selezionato'},
],
destructiveText:“Cancella tutto”,
取消文本:“环”,
按钮勾选:功能(索引){
如果(索引==0)
{                   
//E'una删除
$scope.clients.splice($scope.clients.indexOf(bet),1);
保存($scope.Clients);
}
返回true;
},
//卡塞拉图图
destructiveButtonClicked:function(){
//自由列阵
$scope.clients=[];
保存($scope.Clients);
返回true;
}
});
};
})
.controller('SingleCtrl',函数($scope,$stateparms){
})
除了ion项外,其他功能都很好单击:

<ion-item ng-repeat="client in clients | filter:query" href="#/app/clients/{{ client.name }}">

   <!-- <div class="row" on-hold="showActionsheet(client)"> -->
          {{ client.name }}
    <!-- </div> -->

 </ion-item>

{{client.name}
当我点击它时,我想显示一个包含客户信息的新页面,我的代码怎么了


这里有一个代码笔:

而不是
href
您应该使用来自的
ui sref

例如:

ui-sref="app.clients({clientName:client.name})"

在代码笔中,模板/client.html没有在任何地方定义。client.html只包含
client