Implementing copy-paste directive in my table using Angularjs directive - angularjs

I am displaying some data in tabular format. I am trying to add the ability to copy contents of one cell and paste into another. i know I have to do something like
element.on('ctrl-c',function(e){
$scope.textToBeCopied = element.innerHTML;
})
and then let the cursor move to the relevant position and implement a similar paste function.
Those with knowhow of how to implement this feature kindly advice.
I have a plnkr here:
http://plnkr.co/edit/YyZLVKtRAR1OYGey0FYj

figured it out.
Those who wanna take a look or offer a better solution please see the plnkr.co here
http://plnkr.co/edit/YyZLVKtRAR1OYGey0FYj
Focus on the file copyOn.js
This is where I have defined the copy-paste directive

Related

Is it possible to create demodata for Draft.js?

We are using the draft editor and convertToRaw and convertFromRaw to save and load state from our DB.
For our testing I use factories to create demo data. And want a simple way to generate test data. Simple text is fine.
Is their a function hidden in the library that can help me out?
ideally I could call
textToRaw(`Here is some nice text`)
and that would output something like:
{\"blocks\":[{\"key\":\"4tu7v\",\"text\":\"Here is some nice text\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":{}}],\"entityMap\":{}}
you only need blocks and entityMap. that is simple I think.
convertFromRow({blocks: lines.map(line=>{type:'unstyled', value:line}), entityMap:{}})

How to custom placeholder in international phone number plugin

I have problem with custom placeholder. I am using this https://github.com/mareczek/international-phone-number I want to add more ex. E.g. 131123456789 to my place holder which default gave something like this 131123456789. I read the document they use customPlaceholder to custom place holder, but they do not have any example with angularjs, so could someone show me example code with custom place holder like this.
Here my code that I added to my app
app.config([
'$stateProvider',
ipnConfig,
register_form_state
])->ipnConfig.customPlaceholder = 'E.g. 131123456789'
but it doesn't work for me.
This will solve this problem
http://hodgepodgers.github.io/ng-intl-tel-input/
Please refer this link & this is angularJS plugin
https://github.com/hodgepodgers/ng-intl-tel-input
On selection of country, placeholder will change
The documentation for http://hodgepodgers.github.io/ng-intl-tel-input/ is lacking, but it seems like it could be a good tool. I think I would personally like to see a working implementation inside of an existing application before I'd rule it as the solution to use. I'm still having trouble implementing this one compared to the one by mareczek.
edit To answer your question, I think that it changes the placeholder based on the flag you have selected. If you have it set to a default country, can you not just change the placeholder in the html? Or can you target it directly using css?

Finding an solution on Views?

Hi everyone I am developing an website and I wanna use one block similarly to this link https://careers.mit.edu/#block-views-facts-block.
Which it contains the flowing text and i liked it by the way so i wanna do it similar to this.
Would be grateful if any one suggest me the right way to do it.
they are using Drupal Views to output a text blocks, after custom animate function in JS/JQuery
check this file
https://careers.mit.edu/sites/default/files/js_injector/js_injector_2.js
Drupal.Careers.scrolling_text_animate
and few more to handle text position ...
animate function is quite big, you can do similar or look for an JQ plugin

Can we enable drag and move on UISelect (Multiple) to sort the list?

Im trying to look up to see if UISelect(multiple) provides a feature to drag move items within the control to sort the list ?
I tried googling for the same and couldn't find much information on this.
Appreciate if you can provide link to some kind of documentation so that i can start from there.
NOTE : I fairly understand how UISelect works.
Just for reference: There has been added a sortable="true" option in v0.10. However this feature is not yet properly documented, but for further information, see this github issue or demo-multi-select.html in the examples folder.
It uses the ui-select-match directive as the "template" inside an ng-repeat that generates them.
Unfortunately that ng-repeat, unlike ui-select-choices's repeat parameter is hardcoded inside ui-select's directive templates.
Look at this template: https://github.com/angular-ui/ui-select/blob/master/src/select2/match-multiple.tpl.html
In the build version of ui-select it's inlined using $templateCache, thus you can easily replace it with your own version and apply sorting on that ng-repeat="$item in $select.selected".
You could also integrate something like ngDraggable there.
The main issue here would be CSS though and absolute positioning used.

Implementing basic next/previous picture

I'm trying to convert the Adjuster example mentioned here: http://agiletoolkit.org/learn/understand/view/interactive
into a View that is able to show me the next/previous picture of a list of given images.
I guess the number in the example could be an index into an array of pictures.
I'm just not sure how to provide the list of pictures, when all the code is put in init() for the View, so no way to give it the picturelist before that...
Should I use memorize/recall for this list also to prevent it getting lost upon reload ?
is there another example that might help me?
I think you what you are doing can be much easier done with a classic JavaScript Lightbox script. You would supply it list of images and it would show one full-screen.
If not, you can use this:
https://gist.github.com/romaninsh/7217119
This will give you slides similar to the ones on http://agiletech.ie/
Be advised that this code is a little old.

Resources