Sunday, April 20, 2014

Syntax for accessing Json objects with “–” orspace in key

I  recently had to access Json object returned by Wikipedia with a key  name “query-continue”.

This can be done by using   ECMAscripts "bracket notation" 

response.data['query-continue'].categorymembers.gcmcontinue

refer

access javascript object with space in key

Thursday, April 17, 2014

angularjs page slider

Needed a sliding panel like the ones in Ipad for cascading dropdown. I wanted a button to open the dropdown panel and the panel to close after the last dropdown finished.

I used the nice directive provided by

Daniele Piccone in ng-pageslide

I have given below some code snippets to achieve this using the ng-pageslide directive.

<a  class="btn btn-primary"  ng-click="drop_down_open=true">Open</a>

<pageslide ps-open="drop_down_open" pageslide="left" ps-size="550px" ps-speed="0.5" ps-target="#div_dropdown"></pageslide>

<div id="div_dropdown">

<a ng-click="drop_down_open=false" class="btn btn-primary" >Close</a>
<div data-ng-include data-src="'pages/dropdown.html'">
</div>



In the controller to close or open



$scope.drop_down_open=false;

$scope.drop_down_open=true;