in my app i try to show my search div into my toolbar. Now my searchbar is outside from my toolbar and works fine (show and hide when i click on my search button). When i try to put my searchbar into my toolbar my search button doesnt work (doesnt show).
My html code:
<ons-page ng-controller="alojamientosController" data-ng-init="getAllRecords()">
<ons-toolbar>
<div class="left">
<ons-toolbar-button ng-click="menu.toggle()"><ons-icon icon="ion-navicon-round" fixed-width="false"></ons-icon></ons-toolbar-button>
</div>
<div class="right">
<ons-toolbar-button ng-click="collapse()" ><ons-icon icon="ion-android-search"></ons-icon></ons-toolbar-button>
</div>
<div class="center">Alojamientos</div>
</ons-toolbar>
<div class="searchbar">
<input ng-show="collapsed" type="search" class="search-input" ng-model="search" placeholder="Buscar">
</div>
<div class="app-page alojamientos-page">
<ons-list modifier="news">
<ons-list-item modifier="chevron" class="list-item-container" ng-repeat="item in items | filter:search" ng-click="showPost(item)">
<ons-row>
<div class="thumbnail-box is-loading" images-loaded="imgLoadedEvents">
<img ng-show="{{ item.thumbnail_images }}" ng-src="{{ item.thumbnail_images.full.url }}" class="thumbnail" img-cache>
</div>
</ons-row>
<ons-row>
<div class="cabecera">
<div class="name">
{{ item.title | limitTo: 25 }}
</div>
<div class="location" ng-show="{{ item.categories }}">
</div>
</div>
</ons-row>
</ons-list-item>
</ons-list>
<ons-button id="moreButton" modifier="large" should-spin="{{isFetching}}" ng-click="nextPage()">more news</ons-button>
</div>
</ons-page>
app.js
$scope.collapsed = false;
$scope.collapse = function(){
return $scope.collapsed=!$scope.collapsed;
}
web example in "alojamientos" menu item: http://recorramisiones.com.ar/rutadelaselva/app2/
Thanks a lot
If you really want to put it into the toolbar, I think it should be inside one of the three position classes, something like this:
<div class="center">Alojamientos
<div class="searchbar" style="position:absolute; left:0; right:0">
<input ng-show="collapsed" type="search" class="search-input" ng-model="search" placeholder="Buscar">
</div>
</div>
Then you can use ng-style or ng-class to increase and decrease the height of the toolbar when you show or hide the searchbar and change anything else you need.
Another possibility would be to give to your searchbar's div the appearance of the toolbar with class="navigation-bar searchbar", and then delete the bottom border of the actual toolbar and adjust anything you need.
Related
I'm using md-switch to display a toggle inside of an Angular app. When I click the line it's on, anywhere, the switch toggles. But I've got the switch on a line with other controls so I only want it to toggle when the actual switch is clicked, not some content outside it. How do I instruct it to behave like this?
Snippet:
<md-list-item class="md-1-line" ng-repeat="rule in vm.rules | filter:{name:groupedRule.name}">
<div style="width: 40px;">{{rule.threshold}}</div>
<div flex>
<md-slider min="10" max="40" ng-model="rule.threshold">
</md-slider>
</div>
<div style="width: 40px;">
<md-switch ng-model="rule.enabled"></md-switch>
</div>
Update
Here's a code pen demonstrating the issue: http://codepen.io/jsiegmund/pen/repwyR
Update
Issue #7937 on GitHub: https://github.com/angular/material/issues/7937#issuecomment-207793522
As of current date, the correct solution to this issue is to add class like this:
<md-list-item class="md-no-proxy">
This will prevent the entire line of list item to be clickable.
md-list-item documentation link
You could replace md-list-item with a div - CodePen
Markup
<div ng-controller="SwitchDemoCtrl" ng-app="MyApp">
<md-list>
<div layout="row" layout-align="center center">
<div style="width: 40px;"> {{ data.threshold }} </div>
<div flex>
<md-slider min="10" max="30" step="1" ng-model="data.threshold">
</md-slider>
</div>
<div layout-align="end center" flex-offset="5">
<md-switch ng-model="data.cb1" aria-label="Switch 1">
Switch 1: {{ data.cb1 }}
</md-switch>
</div>
</div>
</md-list>
</div>
So im new to coding and i cant seem to figure out some issue that i have.
<ons-row ng-click="myNavigator.pushPage('{{building.file}}.html')">
So i started and the {{ building.file }} isn't going to the url. can someone help me or explain why it isnt workking? here is my complete code
<div ng-init="buildings = [
{name:'name1',file:'file1', location:'location1', image:'images/img1.jpg', number:'(123) 400-0000'},
{name:'name2',file:'file2', location:'location2', image:'images/img2.jpg', number:'(123) 400-0000'},
{name:'name3',file:'file3', location:'location3', image:'images/img3.jpg', number:'(123) 400-0000'},
]">
<!--There Are {{buildings.length}} restaurants-->
<input type="search" ng-model="q" class="search-input" placeholder="Search..." />
<br />
<ons-list >
<ons-list-item modifier="chevron" class="list-item-container" ng-repeat="building in buildings | filter:q as results">
<ons-row ng-click="myNavigator.pushPage('/' + {{building.file}} + '.html')">
<ons-col width="95px">
<img src="{{building.image}}" class="thumbnail">
</ons-col>
<ons-col>
<div class="name">
{{building.name}}
</div>
<div class="location">
<i class="fa fa-map-marker"></i> {{building.location}}
</div>
<div class="desc">
{{building.number}}
</div>
</ons-col>
<ons-col width="40px"></ons-col>
</ons-row>
</ons-list-item>
</ons-list>
<ul class="example-animate-container">
<li class="animate-repeat" ng-if="results.length == 0">
<strong>No results found...</strong>
</li>
<li class="animate-repeat" ng-if="results.length == 555">
<strong>No results found...</strong>
</li>
</ul>
I don't have your exact code but i think u should not use expression within function call. I created sample demonstration for your app Demo. Please check on console by clicking on name. it logs correct url. Hope this helps!
<div ng-click="pushPage('/' + building.file + '.html')">
{{building.name}}
</div>
I don't see the ons-navigator in your code. The easiest way in angular is to use a var for ons-navigator and then you can use myNavigator.pushPage('name')
<ons-navigator var="myNavigator">
<ons-page>
<ons-row ng-click="myNavigator.pushPage('file.html')" > My Row </ons-row>
</ons-page>
</ons-navigator>
<ons-template id="file.html">
<ons-page>
My Content
</ons-page>
</ons-template>
I have an Onsen-UI template/index where I have a carousel and have each carousel-item calling a ons-template id (html). One of those templates is calling for ng-controller (which is calling for json api) and has usual javascript within it.
If I view the index.html in Chrome, the list shows but when I build it as phonegap app and run the apk on my android device, the list never appears. It just loads in a loop without 'loading' it.
Also, when I click on a list item it should take me to another html template to display the correct information and where (page.html), which Chrome doesn't do (could be just an issue in chrome).
I'm hoping if I get the list to display on my app, then the second part would fix itself or do I need to do some extra tweaking?
Here is my template code calling the controller:
<ons-template id="news.html">
<ons-page>
<div class="app-page opacity-bar">
<div class="app-page-content">
<div class="app-page news-page" ng-controller="newsController" data-ng-init="getAllRecords()">
<ons-list modifier="news">
<ons-list-item modifier="chevron" class="list-item-container" ng-repeat="item in items" ng-click="showPost($index)">
<ons-row>
<ons-col width="95px">
<img ng-show="{{ item.thumbnail_images }}" ng-src="{{ item.thumbnail_images.thumbnail.url }}" class="thumbnail">
</ons-col>
<ons-col>
<div class="name">
{{ item.title | limitTo: 15 }}...
</div>
<div class="location" ng-show="{{ item.categories }}">
<i class="ion-pricetags"></i> <span ng-repeat="cat in item.categories">{{cat.title}} </span>
</div>
<div class="desc">
{{ item.excerpt | htmlToPlaintext | limitTo: 60 }}...
</div>
</ons-col>
<ons-col width="40px"></ons-col>
</ons-row>
</ons-list-item>
</ons-list>
<ons-button id="moreButton" modifier="large" should-spin="{{isFetching}}" ng-click="nextPage()">more news</ons-button>
</div></div></div>
</ons-page>
</ons-template>
The carousel is very weak, bad implemented, i have same issue too, and the support is NULL
May be this link will help for you, Check with the code
<ons-page>
<ons-toolbar>
<div class="center">Carousel</div>
</ons-toolbar>
<ons-carousel ng-controller="CarouselController" swipeable auto-scroll fullscreen var="carousel">
<ons-carousel-item style="background-color: gray;">
<div class="item-label">GRAY</div>
</ons-carousel-item>
<ons-carousel-item style="background-color: #085078;">
<div class="item-label">BLUE</div>
</ons-carousel-item>
<ons-carousel-item style="background-color: #373B44;">
<div class="item-label">DARK</div>
</ons-carousel-item>
<ons-carousel-item style="background-color: #D38312;">
<div class="item-label">ORANGE</div>
</ons-carousel-item>
<ons-carousel-cover>
<div class="bullets">
<span
ng-repeat="idx in indices"
ng-class="{'active': idx === carousel.getActiveCarouselItemIndex()}">
•
</span>
</div>
</ons-carousel-cover>
</ons-carousel>
</ons-page>
I would love to use the power of Famo.us to animate some of my elements in my Angular project. I'm trying to get my head around how to use it with Bootstrap.
For example: I would like to animate a panel when they're loaded. Can I just add the fa-directives into the current HTML? I would love them just to appear within 2 seconds.
<div class="row">
<fa-surface ng-repeat="item in data | filter:search">
<div class="col-md-2">
<div class="panel panel-{{ item.panel }} panel-dark panel-body-colorful widget-profile widget-profile-centered">
<div class="panel-heading">
<i ng-hide="item.img" class="fa fa-user widget-profile-avatar" style="font-size: 5em;"></i>
<img ng-show="item.img" ng-src="item.img" alt="" class="widget-profile-avatar">
<div class="widget-profile-header">
<span>{{ item.firstname }} {{ item.lastname }}</span><br>
</div>
</div> <!-- / .panel-heading -->
<div class="panel-body">
<div class="widget-profile-text" style="padding: 0;">
{{ item.type }}
</div>
</div>
</div>
</div>
</fa-surface>
</div>
Could anyone lead me into the right direction?
You can use fa-animation directive like this on-click example,
in your html:
<fa-modifier fa-size="[100, 100]" fa-translate="boxTransitionable.get()">
<fa-surface fa-background-color="'red'" fa-click="animate()">
<!---panel--->
</fa-surface>
</fa-modifier>
in your angular controller:
var Transitionable = $famous['famous/transitions/Transitionable'];
var Easing = $famous['famous/transitions/Easing'];
$scope.boxTransitionable = new Transitionable([0, 0, 0]);
$scope.animate = function() {
$scope.boxTransitionable.set([200, 300, 0], {duration: 2000, curve: Easing.inOutBack});
};
Source
use the famo.us/angular docs it's very heplful.
I'm losing my mind with this code:
<div class=" col-md-3 col-lg-2 hidden-xs hidden-sm">
<div class="panel-group" id="mainMenuCollapsible">
<div ng-repeat="item in menuItems">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#mainMenuCollapsible" href="#collapse_{{ $index }}">
{{ item }}
</a>
</h4>
</div>
<div id="collapse_{{ $index }}" class="panel-collapse collapse" >
<div class="panel-body">
BLA BL
</div>
</div>
</div>
</div>
</div>
</div>
There no chance to get this working. When I click the title of any panels page reloads showing the panel selected but with no visual effects. My code is exactly the same as bootstrap example.
I have all jss in the right place (jquery 2.0.3, bootstrap.min 3.0.2, angular 1.2).
I also tried removing ng-repeat and doing with a single panel with no luck. What am I missing? Many thanks.
Solved my self. It's angular that intercept the route #collapse_X. Using data-target instead of href:
data-target="#collapse_{{ $index }}"
solved perfectly!
Hope this helps someone.