Ionic search bar - angularjs

I've 3 jsons files linked with 3 controllers, and I need to search on them using ionic/angularjs. I would like the results appear as dropdown menu, like Facebook search or like here in Stackoverflow.
Thank you.

So there are two things here that you want to do:
Be able to search inside JSON file, I think you can do that, there is a SO thread for same : Angular Search for value in JSON and display corresponding data
Display an Auto-complete drop-down, I think there bunch of directives out there, like: https://www.versioneye.com/javascript/sn0opr:ionic-autocomplete/0.1
You can also check following Ionic forum thread for type ahead recommendation:
https://forum.ionicframework.com/t/recomendation-for-a-typeahead-widget/55
If you want to create your own have look at following tutorial:
http://www.sitepoint.com/creating-a-typeahead-widget-with-angularjs/

Related

Drupal 7 contextual filter and exposed filter in calendar views

I've created a calendar views wherein i can see all the events I've created. I also add contextual filter(start_date_of_event) to set the date to current on the first load of the page. It is working fine but my problem is that when i put an exposed filter(start_date_of_event) same field i use in my contextual filter, and tried to run it ? it seems it wont work.
To further explain. Below are the sample link:
1. with contextual filter (working) : http://test.com/test-calendar-listing/2014-12
2. with contextual filter and exposed filter (not working) :http://test.com/test-calendar-listing/2014-12?field_state_country_value=All&field_sample_method_of_delivery_tid=All&field_topics_tid=All&field_provider_type_value=All&field_event_status_value=1&field_start_date_value%5Bvalue%5D%5Bmonth%5D=11&field_start_date_value%5Bvalue%5D%5Byear%5D=2014
What i did so far is used filter harmonizer but no luck.I also tried to used hook_form_alter to redirect the page the link i want but not working also. can you please suggest what is the best thing to do? or what are things i am missing ? thanks for your help.

DecisionTree Selector in AngularJS

I am trying to find a smart way to create a multi-level decision tree selector in angularjs. So, basically what I am looking for is:
If I select Maingroup "GroupA" from a dropdown list, than I should only see the properties from subgroup1 related to GroupA. The subgroup1 should be also a dropdownlist. Then, refining the selection by another dropdownlist, should display only the possible selections based on Maingroup+Subgroup1.
Finally, the value should be displayed.
[{"Maingroup":"GroupA","Subgroup1":"subgroupA1","Subgroup2":"subgroupA21","Value":11.34},
{"Maingroup":"GroupA","Subgroup1":"subgroupA1","Subgroup2":"subgroupA22","Value":40.7},
{"Maingroup":"GroupA","Subgroup1":"subgroupA2","Subgroup2":"subgroupA23","Value":58.23},
{"Maingroup":"GroupA","Subgroup1":"subgroupA2","Subgroup2":"subgroupA24","Value":20.64},
{"Maingroup":"GroupA","Subgroup1":"subgroupA2","Subgroup2":"subgroupA25","Value":74.77},
I have put a screenshot and the json file on github.
Thanks, any suggestion is welcome.
Take a look at angular-ui-tree connected trees demo. The structure can be reused to achieve your goals.

How to count elements on web page?

Open one web page say gmail.
Want to count that how many text field or buttons or checkbox or hyperlinks or other html elements are present.
The solution is very simple . This can be done using simple XPath.
Find the type of element count you need.
eg for text fields: xpath can be : input[type='text']
for radio buttons: xpath can be : //input[#type='radio']
for check box buttons: xpath can be : //input[#type='checkbox']
so find all the elements in the page by using simple command using the above xpath:
webdriver.findElements(By.xpath("REQUIRED_XPATH")).size();
will give you the number of elements in the particular web page.
I am using c#. If you use c# as well the followings is the something you want to use. And you decide what tags you need inside the selector. I am using all the tags so far.
ReadOnlyCollection<IWebElement> webElements = Driver.FindElements(By.CssSelector("input, select, textarea, a, button"))//and keep adding
//then do a simple count. The trick here is the selector and you need to make sure you are adding all the tag names are being used in your application
webElements.Count();
If you want to count all elements of a page, you can simply use * for that as shown below.
List<WebElement> items = driver.findElements(By.cssSelector("*"));
System.out.println(items);
Here is how to know instantly how many items in the list on the website, for example, languages in the wiki, using right-click "Inspect element".
Screenshot

Manipulating Soundcloud Stream with Chrome Extension Content Script

I am writing a Chrome extension using AngularJS to add functionality to the Soundcloud stream page. I want to allow the user to create groups of artists so that they may only see a stream with tracks/shares/playlists from that group of artists.
For example, I follow 500 artists, but I want to quickly see a stream from my favorite 10 artists or from the artists I follow that are on the same label.
I am looking for advice on how I could go about making this as seamless as possible. As of right now, my approach involves getting the tracks with the Soundcloud API and using angular's ng-repeat to display the tracks in a view injected into where the stream normally goes. I realized using the Soundcloud widget was too slow and can't be customized to resemble the native stream items, so I copy/pasted the HTML that an actual stream item uses, but obviously the waveform/comment canvas and button functionality don't work.
What are my options as far as how I can approach this? Am I going to need to write my own players that look like the native Soundcloud ones? Any suggestions would be greatly appreciated.
You should use the SoundCloud API which is very well documented.
If you have already the id's of the tracks / artist, you just have to request the url
GET
http://api.soundcloud.com/tracks/ID_OF_TRACK.json?client_id=YOUR_CLIENT_ID
to get all the informations you need about this track, like the waveform_url, and for the comments you was talking about :
GET
http://api.soundcloud.com/tracks/ID_OF_TRACK/comments.json?client_id=YOUR_CLIENT_ID
To reproduce the behaviour of the comments :
POST http://api.soundcloud.com/tracks/ID_OF_TRACK/comments.json?client_id=YOUR_CLIENT_ID
(with a body param which represents the text and a timestamp in ms since the beginnin of the song, note that you must be connected)
If you don't have the id of the track, you could also use the resolve which give you all the info about a ressource if you have only the URL :
GET
http://api.soundcloud.com/resolve.json?url=https://soundcloud.com/poldoore/pete-rock-c-l-smooth-they&client_id=YOUR_CLIENT_ID

two independent dropdowns with xml binded data - cakephp - best method?

What's best method within cakephp site for-
two dropdowns
one listing cds, one listing artists
on select of either cd or artist I need my additional text to appear below dropdowns
I have been searching through tutorials and manual - with no success. I am looking to learn by basic example - from form/view and controller.
latest try was something along this example to get dropdown [Dropdown select list in CakePHP
Although CakePHP techniques apply, the way that I'd do this in CakePHP is the same way I'd do it in any app. I'd use Javascript (the jQuery framework in my case) to:
Bind an event handler to the change event of each dropdown
Make an Ajax call to a URI that returns the "additional text" to be displayed below the dropdown
Display said text
In the CakePHP context, I'd create methods in my CdsController and ArtistsController (I'm guessing at your naming convention, of course) to respond to the Ajax request.

Resources