{"id":2329,"date":"2015-11-26T10:55:00","date_gmt":"2015-11-26T10:55:00","guid":{"rendered":"http:\/\/www.nikola-breznjak.com\/blog\/?p=2329"},"modified":"2015-11-26T11:15:50","modified_gmt":"2015-11-26T11:15:50","slug":"how-to-design-a-two-column-button-in-ionic-framework","status":"publish","type":"post","link":"https:\/\/nikola-breznjak.com\/blog\/stack-overflow\/how-to-design-a-two-column-button-in-ionic-framework\/","title":{"rendered":"How to design a two column button in Ionic framework"},"content":{"rendered":"<p><a href=\"http:\/\/stackoverflow.com\/users\/534755\/nikola\"><img loading=\"lazy\" decoding=\"async\" title=\"profile for Nikola at Stack Overflow, Q&amp;A for professional and enthusiast programmers\" src=\"http:\/\/stackoverflow.com\/users\/flair\/534755.png\" rel=\"lightbox[2329]\" alt=\"profile for Nikola at Stack Overflow, Q&amp;A for professional and enthusiast programmers\" width=\"208\" height=\"58\" \/><\/a><br \/>\nI&#8217;m a big fan of <a href=\"http:\/\/stackoverflow.com\/\">Stack Overflow<\/a> and I tend to contribute regularly (am currently in the <a href=\"http:\/\/stackexchange.com\/leagues\/1\/alltime\/stackoverflow\/2008-07-31\/534755?sort=reputationchange#534755\">top 0.X%<\/a>).\u00a0In this category (<a href=\"http:\/\/www.nikola-breznjak.com\/blog\/category\/stack-overflow\/\">stackoverflow<\/a>)\u00a0of posts, I will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread <a href=\"http:\/\/meta.stackoverflow.com\/questions\/266971\/can-i-post-so-questions-and-answers-in-a-personal-blog\/266973\">here<\/a>.<\/p>\n<p>As you may know, I&#8217;m really into Ionic framework lately\u00a0and am helping out on StackOverflow with the knowledge I gained so far with the framework. I&#8217;m in the <a href=\"http:\/\/stackoverflow.com\/tags\/ionic\/topusers\">top All time answerers<\/a> list.<\/p>\n<p>I actually asked\u00a0<a href=\"http:\/\/stackoverflow.com\/questions\/30709041\/how-to-design-a-two-column-button-in-ionic-framework\">this question<\/a>\u00a0myself:<\/p>\n<p>What I would like to achieve is this:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/Wgtkb.jpg\" alt=\"enter image description here\" \/><\/p>\n<p>Surely, I went through the <a href=\"http:\/\/ionicframework.com\/docs\/components\/#buttons\" rel=\"nofollow\">button<\/a> documentation, but it seems nothing similar is there. So, I would appreciate some pointing in the right direction (codepen with a basic example would be most awesome).<\/p>\n<p>So, ideally, this would be one button tag where I would be able to pass two variables (one which would appear on the left and one on the right). This does smell like a job for a Angular directive, though I haven&#8217;t fiddled with it too much just yet so a friendly nudge in the right direction would be appreciated.<\/p>\n<p>Answer from <a href=\"http:\/\/stackoverflow.com\/users\/1534554\/malek-hijazi\">Malek Hijazi<\/a>\u00a0was pointing out to use the <a href=\"http:\/\/ionicframework.com\/docs\/components\/#button-bar\">ButtonBar<\/a>\u00a0component, but I already knew about it and it wasn&#8217;t what I needed. Finally, I managed to\u00a0answer\u00a0this question myself after some fiddling with it:<\/p>\n<blockquote><p>What I ended up doing in the end was this: I created a <code>div<\/code> with a class <code>button<\/code> and then inside it I created additional two <code>div<\/code>&#8216;s with custom classes.<\/p>\n<p>How this looks like on CodePen:<\/p>\n<p>And, the code below:<\/p>\n<pre class=\"lang:default decode:true\">.leftButtonSide {\r\n    width: 50%;\r\n    float: left;\r\n    color: #000;\r\n}\r\n\r\n.rightButtonSide {\r\n    width: 50%;\r\n    float: left;\r\n    background: #F2F2F2;\r\n    color: #000;\r\n    border-radius: 2px;\r\n}<\/pre>\n<pre class=\"lang:default decode:true\">&lt;div ng-repeat=\"d in data\" class=\"button button-positive-outline\"&gt;\r\n    &lt;div class=\"leftButtonSide\"&gt;2&lt;\/div&gt;\r\n    &lt;div class=\"rightButtonSide\"&gt;2,00&lt;\/div&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>True, for the exact same look you would have to play a bit with CSS. I ended up with this in the end:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/XdbUe.jpg\" alt=\"\" \/><\/p>\n<p>Hope this helps someone too!<\/p>\n<p>https:\/\/twitter.com\/HitmanHR\/status\/669836667893768192<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%).\u00a0In this category (stackoverflow)\u00a0of posts, I will be posting my&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1991,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43,35],"tags":[],"class_list":["post-2329","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ionic","category-stack-overflow"],"_links":{"self":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/2329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/comments?post=2329"}],"version-history":[{"count":4,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/2329\/revisions"}],"predecessor-version":[{"id":2333,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/2329\/revisions\/2333"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media\/1991"}],"wp:attachment":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media?parent=2329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/categories?post=2329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/tags?post=2329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}