How can I make my own autocomplete input field library in angular.
I have take a reference from angular material but I am unable to create my own directives o it.
Related
I have a Svelte app set up so that there's an App component, a Chart component and a Header component.
The App component pulls in data. The Chart component displays the data.
The Header component has an <input>. I want to be able to enter a search string in that input, in the Header component, and have it filter the data that's in the App component.
I'm not there yet. Here is my work in progress.
Right now, I have an <input> in the App component, too. And that one is correctly filtering my data that shows up in the Chart component.
I just want to be able to use the <input> in Header.
I've found how I can bind the header input text to App, as shown in my REPL, but how do I use that text as a variable?
All help very welcome.
Again, here's the REPL.
Currently you are binding the value from the header to a store, while your local search input binds to search, which you then use for filtering
<Header bind:value={$store} />
<input bind:value={search}>
But you are actually not doing anything with this store, not even sure why it is a store since you don't need that part here. Nothing stops you from using bind in a component to connect to a regular value
<Header bind:value={search}>
The tag <md-hint> is not working in Angular Material 1.1.0-rc2.
I even tried using <div class="hint"></div> as defined in Documentation but gives out same result
I've created a CodePen with V1.1.0-rc2 that shows input hints as displayed in the online demos.
md-hint is not a directive in Angular Material 1.1.0-rc2
The style of the hints isn't a part of Angular Material but a stand alone CSS (not sure why they don't actually create a md-hint directive):
I'm migrating an app from rails to volt which uses some jquery plugins.
As example, one of them is http://ionden.com/a/plugins/ion.rangeSlider/en.html
I'm using opal-jquery inside action_ready to call the plugin, and visually it works. However internally it hides the original input and uses .val() to set the value for that input once the slider gets moved by the user. The problem is that even that the input is declared with a reactive field as its value, once jquery changes its value, the variable stays the same instead of syncing with the input value
this problem could be reproduced by creating a input like
<input type="text" value={{_value}} id="example"/> <p>{{_value}}</p>
and in the console do something like
$('#example').val('only the visual will change')
the same thing would apply for other plugins like jquery.ui sortable in which the callback would populate a field from the model with a index value.
is there a way to make legacy plugins that change values work with voltrb?
What it says in the title. I have a simple app that needs the functionality, but can be otherwise written in plain clojurescript so it seems pretty wasteful to load jQuery and jQueryUI just for that.
The closest thing to jQueryUI's Sortable in the google closure library is goog.fx.DragListGroup. As far as I know there is no ClojureScript wrapper for that, but it should be fairly simple to code against it directly and since it's in the closure library it should optimize well too. The basic idea is that you instantiate a DragListGroup for each independent list that you want to be sortable, and then add the list element to that group using addDragList. You can also add multiple list elements to the same group if you want to be able to drag elements between lists.
Here is one way to get this working. You'll need to use an extern file so Google Closure can read the jQuery libraries. There is one for the main jQuery already published and I posted one that works well for jQuery-ui's sortable. The project.clj should have a reference to the extern, so include something like this:
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/clojurescript "0.0-1806"]
[jayq "2.3.0"]]
:plugins [[lein-cljsbuild "0.3.1"]]
:cljsbuild {
:builds [
{:source-paths ["src"]
:compiler
{:output-to "resources/public/js/out.js"
:optimizations :advanced
:pretty-print false
:externs ["resources/public/externs"]}}]})
Then write some cljs for the sortable function (jayq makes this easy):
(ns sortable.core
(:use [jayq.core :only [$]]))
(defn sortable [$elem]
(.sortable $elem))
(defn disable-selection [$elem]
(.disableSelection $elem))
(let [$sortable ($ :#sortable)]
(sortable $sortable)
(disable-selection $sortable))
And include an index.html file for the project like this.
There might be some way to compile the jQuery libraries directly with :foreign-libs in the project.clj but I'm not sure how to do that.
EDIT: Sorry this still uses the entire jQuery library so it doesn't really answer the question.
Because I have no clue about clojurescript I can't give you a proper solution in clojurescript but jQuery and jQuery UI shouldn't be that wasteful.
You could include the jQuery library by making use of the Google CDN. Lots of websites use this source and therefore the file gets cached and won't be downloaded again and again.
See this link.
//you can of course easily change the version you want to use, like 1.9.1
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script
The same could be done for jQuery UI
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
But if you just want to use the sortable widget of jQuery UI you could simply use their Download Builder.
Just uncheck the "Toggle all" checkbox below "Components" and then check the sortable checkbox in "Interactions".
Download your customized jQuery UI version and all you need to include is the jquery-ui-1.10.3.custom.min.js file. The Download Builder downloads a CSS theme also but for the sortable widget I see no need to include it.
But in fact including jQuery UI from Google CDN is also a good choice. If you host the libraries locally your users must download it at least once. If you use Google most of the user won't need to download the files. (unless the version is different)
Just a suggestion if there's nothing in clojurescript which could help you out.
I am working with a form in symfony in which I need to use both the autocomplete and the datepicker functionalities. For autocomplete I am using sfExtraWidgetFormInputAutocomplete and for datepicker I am using sfWidgetFormDateJQueryUI in my form configure() method. In my form first widget using autocomplete is rendered and then the datepicker widget. I have read that there is some compatibility issue with these two.
Please tell me how to make them both work in single form.
use this line on the top of the page:
jq_add_plugins_by_name(array('autocomplete'));