ionic collection-repeat not working - angularjs

When I refer the item individualy on angularJS it works fine, but in collection not work.
This colletcion not working in my ionic project, anyone knows what is wrong ?? thanks !
//JavaScript part
//HTML part
MapApp.controller('MenuCtrl', function($scope) {
$scope.itens = [
{titulo: 'Mapa'},
{titulo: 'Login'},
{titulo: 'Sobre'}
];
$scope.TituloMenu = 'Menu';
//$scope.currItens = $scope.itens;
});
<!-- NOT WORK -->
<ion-item nav-clear menu-close href="#/map/login"
collection-item-height="52" collection-repeat"item in itens" class="item item-icon-left"
item-height="250" item-width="100%">
<i class="icon ion-chevron-right"></i>{{item.titulo}}
</ion-item>
<!-- IT WORK -->
<ion-item nav-clear menu-close href="#/map/login" class="item item-icon-left" >
<i class="icon ion-ios-arrow-right"></i>{{itens[0].titulo}}
</ion-item>
<ion-item nav-clear menu-close href="#/map/login" class="item item-icon-left" >
<i class="icon ion-ios-arrow-right"></i>{{itens[1].titulo}}
</ion-item>
<ion-item nav-clear menu-close href="#/map/login" class="item item-icon-left" >
<i class="icon ion-ios-arrow-right"></i>{{itens[2].titulo}}
</ion-item>

You are missing an equals sign in the html.
collection-repeat"item in itens"
collection-repeat="item in itens"

Related

how to enable side menu based on condition in ionic

Below are my HTML code which am using to enable side menu using ionic framework
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="bar bar-header bar-custom">
<ion-nav-buttons side="left">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left"> </button>
</ion-nav-buttons>
<ion-nav-back-button class="button-clear" ng-click="myGoBack()"> <i class="ion-arrow-left-c"></i> </ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view cache-view="false" class="roAppStyle" name="menuContent"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left" expose-aside-when="large">
<ion-header-bar class="bar-stable">
<h1 class="title item-icon-left "> <i class="icon ion-person"></i>{{user.name}} </h1> </ion-header-bar>
<ion-content>
<ion-list>
<ion-item ng-repeat="menu in sideMenuList" class="item item-icon-left" menu-close ng-click={{menu.method}}> <i class={{menu.icon}}></i> {{menu.label}} </ion-item>
<!-- <ion-item class="item item-icon-left" menu-close ui-sref="app.home"> <i class="icon ion-ios-home"></i> Home </ion-item> <ion-item class="item item-icon-left" menu-close ng-click="goToProducts()" > <i class="icon ion-egg"></i> Products </ion-item> <ion-item class="item item-icon-left" menu-close ng-click="goToOrder()" > <i class="icon ion-android-cart"></i> Order </ion-item> <ion-item class="item item-icon-left" menu-close ng-click="goToDeliveryAgent()" > <i class="icon ion-android-person"></i> Delivery Agent </ion-item> <ion-item class="item item-icon-left" menu-close ng-click="goToOffers()" > <i class="icon ion-pricetags"></i> Offers </ion-item> -->
<!-- <ion-item menu-close class="item item-icon-left" ui-sref="app.offers"> <i class="icon ion-pricetags"></i> Offers </ion-item> -->
<ion-item class="item item-icon-left" ng-click="exitTheApp()"> <i class="icon ion-log-out"></i> Exit </ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
Client code:
app.controller('appCtrl', function($scope, $state, baseConstant, $ionicHistory, $ionicPopup, $rootScope, angularService, webSocketConnection) {
$scope.goToProducts = function() {
$state.go('app.product');
}
$scope.goToDeliveryAgent = function() {
$state.go('app.deliveryAgent');
}
$scope.goToOffers = function() {
$state.go('app.offers');
}
$scope.goToOrder = function() {
$state.go('app.order');
}
$scope.goToDeliveryAcceptedOrder = function() {
$state.go('app.deliveryacceptedOrders');
}
$scope.goToDeliveryCancelOrder = function() {
$state.go('app.deliveryCancelOrders');
}
if ($rootScope.user.type === baseConstant.RO_USER_TYPE) {
$scope.sideMenuList = baseConstant.roUserMenus;
$state.go("app.product");
}
else if ($rootScope.user.type === baseConstant.DELIVERY_USER_TYPE) {
$scope.sideMenuList = baseConstant.deliveryUserMenus;
$state.go("app.deliveryacceptedOrders");
}
$scope.myGoBack = function() {
$ionicHistory.goBack();
};
$scope.exitTheApp = function() {
var confirmPopup = $ionicPopup.confirm({
title: 'Alert',
template: 'Are you sure you want to exit the app..?'
});
confirmPopup.then(function(res) {
if (res) {
var socketConnection = webSocketConnection.getWebSocketConnection(baseConstant.OFFLINE);
navigator.app.exitApp();
}
});
}
$scope.imageUrl = baseConstant.IMAGE_URL;
});
when it is ro user the first screen of ro user has menu button but when i register as delivery user the first screen of delivery user has back button.i want side menu button

Ionic navigation controllers

I need to have three types of navigation in my Ionic app. Is there anything that I can do to minimize my code?
Main problem: All three navigation has the same side menu, but different header navigation.
My code for first navigation:
<ion-side-menus>
<ion-side-menu-content drag-content="false">
<ion-nav-bar class="bar-traveler">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-title class="heder-tabs">
<div class="heder-avatar">
<a >
<img src="img/default-avatar.png">
</a>
<div class="karma-box-heder">1243</div>
</div>
<span><a >Travel</a></span>
<span><a >Location</a></span>
<span><a >Networking</a></span>
</ion-nav-title>
<ion-nav-buttons side="right">
<button class="button button-icon button-clear ion-navicon" menu-toggle="right">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view class="has-header"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="right" class="has-header-nav">
<ion-content class="navigation-bg-color">
<ion-list class="app-right-navigation">
<ion-item class="side-navigation-user sidenav-box" menu-close href="">
<div class="user-nav">
<div class="user-sidenav-logo">
<img src="img/default-avatar.png">
<div class="karma-box">1243</div>
</div>
<div class="first-three-nav-choice">User Name</div>
</div>
</ion-item>
<ion-item class="side-navigation-pinko sidenav-box" menu-close href="">
<div class="pinko-nav">
<div class="pinko-sidenav-logo">
<img src="img/pro4travel-logo.png">
</div>
<div class="first-three-nav-choice">Pinko</div>
</div>
</ion-item>
<ion-item class="side-navigation-club sidenav-box" menu-close href="">
<div class="club-nav">
<div class="club-sidenav-logo">
<img src="img/app4travel-logo.png">
</div>
<div class="first-three-nav-choice">Club</div>
</div>
</ion-item>
<ion-item class="other-nav-text" menu-close href="">
<div class="icon-navigation"><i class="fa fa-th-large" aria-hidden="true"></i></div>
<div class="text-nav-list">My Agency</div>
</ion-item>
<ion-item class="other-nav-text" menu-close href="">
<div class="icon-navigation"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></div>
<div class="text-nav-list">My Karma</div>
</ion-item>
<ion-item class="other-nav-text" menu-close href="">
<div class="icon-navigation"><i class="fa fa-bullhorn" aria-hidden="true"></i></div>
<div class="text-nav-list">Notification</div>
</ion-item>
<ion-item class="other-nav-text" menu-close href="">
<div class="icon-navigation"><i class="fa fa-user-circle" aria-hidden="true"></i></div>
<div class="text-nav-list">Profile</div>
</ion-item>
<ion-item class="other-nav-text" menu-close href="">
<div class="icon-navigation"><i class="fa fa-cog" aria-hidden="true"></i></div>
<div class="text-nav-list">Settings</div>
</ion-item>
<ion-item class="other-nav-text" menu-close href="">
<div class="icon-navigation"><i class="fa fa-sign-out" aria-hidden="true"></i></div>
<div class="text-nav-list">Log out</div>
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
So Box1 on picture is the box that containts my Header navigation(navigation that needs to be diffrent on other two navigation)
And Box2 on picture is box thats stays the same.
Aslo here is picture how to looks in my app:
So depent on what page is the box1 need to be changed and box2 needs to stay the same.

How to add and hide item in ionic?

i have a side-menu and i want to change the item of this side
eg: if user is connect ==> item my account is show
but if user is not connect ==>item my account is hide
in my controller:
facebookExample.controller("accueilController", function($scope, $cordovaOauth, $localStorage, $location,$ionicPopup,$state,$http) {
$scope.connect=true;
$localStorage.connect=true;
in the index.html :
<body ng-app="starter" ng-controller="accueilController" >
<ion-item class="item" nav-clear menu-close href="#/login" ng-show="connect=='true'">
<i class="fa fa-user" style="padding-right: 190px;"></i> <div style="padding-left: 25px;padding-top: 5px;">My account </div>
</ion-item>
i found nothing ,what can i do ,i use ng-if or ng-how and how ??
help me please
Try removing that check in the ng-show
<body ng-app="starter" ng-controller="accueilController" >
<ion-item class="item" nav-clear menu-close href="#/login" ng-show="connect">
<i class="fa fa-user" style="padding-right: 190px;"></i>
<div style="padding-left: 25px;padding-top: 5px;">My account</div>
</ion-item>

Left to right slider is not working

Here is my link http://codepen.io/sanand29/pen/mKkvw
<html ng-app="ionicApp">
<title>Ionic Template</title>
<link href="http://code.ionicframework.com/1.0.0-beta.8/css/ionic.css" rel="stylesheet">
<script src="http://code.ionicframework.com/1.0.0-beta.8/js/ionic.bundle.js"></script>
</head>
<body ng-controller="MyCtrl">
<ion-view class="pane"></ion-view>
<ion-side-menus>
<ion-side-menu-content>
<ion-header-bar class="bar-positive">
<button class="button button-icon icon ion-navicon-round"
menu-toggle="left"
></button>
<h1 class="title">Welcome</h1>
</ion-header-bar>
<ion-list>
<ion-item href="#/tab/admission-information" class="item item-icon-right ">
Admission-Information
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
<ion-item href="#/tab/contacts" class="item item-icon-right ">
Contacts
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
<ion-item href="#/tab/program-details" class="item item-icon-right ">
Program details
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
<ion-item href="#/tab/tution-fees" class="item item-icon-right ">
Tution fees
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
<ion-item href="#/tab/financial-aids" class="item item-icon-right ">
Financial Aids
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
<ion-item href="#/tab/faqs" class="item item-icon-right ">
FAQs
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
</ion-list>
</ion-side-menu-content>
<ion-side-menu side="left">
<ion-header-bar class="bar-assertive">
<h1 class="title">Left menu</h1>
</ion-header-bar>
</ion-side-menu>
</ion-side-menus>
<script type="text/javascript">
angular.module('ionicApp', ['ionic'])
.controller('MyCtrl', function($scope) {
});</script>
the navigation bars that i have given, on clicking them its not sliding from left to right. I have given the slider class correctly i think,,I can't find out my fault. Kindly show in fiddle or code pen. Any help would be appreciated
If you want to get the view to slide in when a tab is clicked you should use an animation class on an ion-nav-view.
If you want to get the view to slide in when the user slides across the view you should use an ion-slide-box

ionic - How to create small icon inside sidemenu?

I got a design from client. I want to embed small icon inside my sidemenu.
My current code
<ion-side-menus>
<ion-pane ion-side-menu-content>
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-clear"><i class="icon ion-ios7-arrow-back"></i> Back</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view name="menuContent" animation="slide-left-right"></ion-nav-view>
</ion-pane>
<ion-side-menu side="left">
<header class="bar bar-header bar-stable">
<h1 class="title">Menu</h1>
</header>
<ion-content class="has-header">
<ion-list>
<ion-item nav-clear menu-close href="#/app/home">
Home
</ion-item>
<ion-item nav-clear menu-close href="#/app/profile">
Profile
</ion-item>
<ion-item nav-clear menu-close href="#/app/friend">
Friends
</ion-item>
<ion-item nav-clear menu-close href="#/app/setting">
Setting
</ion-item>
<ion-item nav-clear menu-close href="#/app/shop">
Shop
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
My objective
I already got the answer
<ion-side-menus>
<ion-pane ion-side-menu-content>
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-clear"><i class="icon ion-ios7-arrow-back"></i> Back</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view name="menuContent" animation="slide-left-right"></ion-nav-view>
</ion-pane>
<ion-side-menu side="left">
<header class="bar bar-header bar-stable">
</header>
<ion-content class="has-header mymenu">
<ion-list>
<ion-item nav-clear menu-close href="#/app/home">
<img src="img/home.png" width="30" />Home </ion-item>
<ion-item nav-clear menu-close href="#/app/profile">
<img src="img/profile.png" width="30" />Profile </ion-item>
<ion-item nav-clear menu-close href="#/app/friend">
<img src="img/friend.png" width="30" ng-click="friend()"/>Friends
</ion-item>
<ion-item nav-clear menu-close href="#/app/setting">
<img src="img/setting.png" width="30" />Setting
</ion-item>
<ion-item nav-clear menu-close href="#/app/shop">
<img src="img/shop.png" width="30" ng-click="shop()"/>Shop
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
All you have to do is add the icon that you want in the same as the text. Here is an example: http://plnkr.co/edit/KIErTU?p=preview
<ion-item>
<i class='ion-checkmark-circled'></i>home
</ion-item>
Nothing pretty, but it shows the point.
<ion-item menu-close class="item-icon-left">
<i class="icon ion-home" ></i>
Home
</ion-item>
Add class item-icon-leftto ion-item to nicely style and align the icons.
Here is How You can so it while keeping ionic sidemenu intact.
This is for ionic 2:-
app.component.js
pages: Array<{
title: string,
component: any ,
icon: string,
class: string
}>;
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) {
this.initializeApp();
// used for an example of ngFor and navigation
this.pages = [
{
title: 'Home',
component: HomePage ,
icon: '<i class="fa fa-pencil"></i>' ,
class: 'class1'
},
{
title: 'List',
component: ListPage ,
icon: '<i class="fa fa-plus"></i>' ,
class: 'class2'
},
{
title: 'Login Page',
component: LoginPage ,
icon: '<i class="fa fa-book"></i>' ,
class: 'class3'
}
];
}
app.html:-
<ion-content>
<ion-list>
<button [ngClass]="p.class" menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">
<span class="menu_item_icon" [innerHTML]="p.icon"></span>
<span class="menu_item_title">
{{p.title}}
</span>
</button>
</ion-list>
</ion-content>
I used the ionic default boilerplate that contains the sidemenu.
Am new to Angular2. But I like doing things the clean way.
You could use what Afflicted suggested but the following solution I used has a correct outlining:
<div class="list">
<a class="item item-icon-left" href="#">
<i class="icon ion-email"></i>
Check mail
</a>
...
List icons in ionic

Resources