<!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 data-require="ionic@1.0.0-beta.1" data-semver="1.0.0-beta.1" rel="stylesheet" href="http://code.ionicframework.com/1.0.0-beta.1/css/ionic.css" />
<link rel="stylesheet" href="style.css" />
<script data-require="ionic@1.0.0-beta.1" data-semver="1.0.0-beta.1" src="http://code.ionicframework.com/1.0.0-beta.1/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<script src="app.js"></script>
<script src="controllers.js"></script>
<script src="services.js"></script>
</head>
<body ng-app="starter" animation="slide-left-right-ios7">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-chevron-left">
Back
</ion-nav-back-button>
</ion-nav-bar>
<!--
The views will be rendered in the <ion-nav-view> directive below
Templates are in the /templates folder (but you could also
have templates inline in this html file if you'd like).
-->
<ion-nav-view></ion-nav-view>
</body>
</html>
/* Styles go here */
// Ionic Starter App, v0.9.20
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.services' is found in services.js
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
StatusBar.styleDefault();
});
})
.config(function($stateProvider, $urlRouterProvider) {
// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state's controller can be found in controllers.js
$stateProvider
// setup an abstract state for the tabs directive
.state('tab', {
url: "/tab",
abstract: true,
templateUrl: "tabs.html"
})
// Each tab has its own nav history stack:
.state('tab.dash', {
url: '/dash',
views: {
'tab-dash': {
templateUrl: 'tab-dash.html',
controller: 'DashCtrl'
}
}
})
.state('tab.friends', {
url: '/friends',
views: {
'tab-friends': {
templateUrl: 'tab-friends.html',
controller: 'FriendsCtrl'
}
}
})
.state('tab.account', {
url: '/account',
views: {
'tab-account': {
templateUrl: 'tab-account.html',
controller: 'AccountCtrl'
}
}
})
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/tab/dash');
});
This is a blank ionic framework starter template.
https://github.com/driftyco/ionic-starter-tabs
angular.module('starter.controllers', [])
.controller('DashCtrl', function($scope) {
$scope.locais = [{
ID: 109,
Nome: 'Aeroporto Internacional Hercilio Luz'
}, {
ID: 161,
Nome: 'Koxixos'
}, {
ID: 184,
Nome: 'Praça XV de Novembro'
}];
$scope.localSelectChange = function() {
// returns undefined. why?
alert('$scope.selectedLocal: ' + $scope.selectedLocal);
}
})
.controller('FriendsCtrl', function($scope) {
})
.controller('AccountCtrl', function($scope) {
})
.controller('MyCtrl', function($scope) {
$scope.cidades = [{
ID: 109,
Nome: 'Florianópolis'
}, {
ID: 161,
Nome: 'São José'
}, {
ID: 184,
Nome: 'Palhoça'
}];
$scope.cidadeSelectChange = function() {
// returns the object, as expected
alert('$scope.selectedCidade: ' + $scope.selectedCidade);
}
});
<ion-view title="Account">
<ion-content class="has-header padding">
</ion-content>
</ion-view>
<ion-view title="Dashboard">
<ion-content class="has-header padding">
<p>
please help me understand this. see tab-dash.html and controllers.js
</p>
<div ng-controller="MyCtrl">
<select ng-model="selectedCidade" ng-options="item.Nome for item in cidades" ng-change="cidadeSelectChange()">
<option value="">Cidades</option>
</select>
<p>this one works as expected</p>
</div>
<select ng-model="selectedLocal" ng-options="item.Nome for item in locais" ng-change="localSelectChange()">
<option value="">Locais</option>
</select>
<p>on this one the select change function can't retrieve the model. returns undefined. why?</p>
</ion-content>
</ion-view>
<ion-view title="Friends">
<ion-content class="has-header">
</ion-content>
</ion-view>
<!--
Create tabs with an icon and label, using the tabs-positive style.
Each tab's child <ion-nav-view> directive will have its own
navigation history that also transitions its views in and out.
-->
<ion-tabs class="tabs-icon-top">
<!-- Pets Tab -->
<ion-tab title="Dashboard" icon="icon ion-home" href="#/tab/dash">
<ion-nav-view name="tab-dash"></ion-nav-view>
</ion-tab>
<!-- Adopt Tab -->
<ion-tab title="Friends" icon="icon ion-heart" href="#/tab/friends">
<ion-nav-view name="tab-friends"></ion-nav-view>
</ion-tab>
<!-- About Tab -->
<ion-tab title="Account" icon="icon ion-gear-b" href="#/tab/account">
<ion-nav-view name="tab-account"></ion-nav-view>
</ion-tab>
</ion-tabs>