How to open Mobile-Angular-ui modal from controller - javascript

I have seen the demo to show pop-up
http://mobileangularui.com/demo/#/overlay
In the example has been used Directive into template
ui-turn-on="modal1"
I need to activate the pop-up from controller.
I think I have to use SharedState, but I was unable to create a working example.
Can you help me?

I had similar problem.
The following code solved my problem:
$rootScope.Ui.turnOn('modal1')

You need to declare the SharedState in the controller and then just use it like this:
SharedState.turnOn('name_of_modal_id');
and/or
SharedState.turnOff('name_of_modal_id');
Does not require anything special.
Its simple.

Related

Open Javascript code in editor on click

I am trying to create an interactive tutorial for learning an API. I've been googling my options for an entire day now. I came across ace, code mirror etc. but I'm not sure how I can use them in my case.
What I wish to do is that when the user clicks a button, a javascript code linked to it should open up in an editor on the same webpage. This would aid the users to see how the code is working and give them scope to modify and learn.
I know its not a constructive question but any help is appreciated! Thanks!
you can just wantch here how it is done
They made it with knockout MVVM but you can use angular or anything else you like.
I used tags to store my code and displayed it using codemirror's setValue property mentioned by #georg.

AngularJS calling controller method from a directive with parameters

I am new to Angular JS and starting to work on creating custom directives for one of our projects. Part of the requirement is to create an angular tree and I have took the code from a sample plunkr created by some one. It is not my code and I tried to extend it.
I have to call the controller method with arguments from the directive. I tried with answers on the stack overflow but couldn't solve the issue I am facing. It seems some where I am making a mistake in the recursive calling. The controller method is being called but the argument is undefined. Below is the plnkr code I have.
http://plnkr.co/edit/76iQdnLQyu4k9cn4eId5?p=preview
I appreciate your help on this.
Thanks,
veera
In the choiceTree directive's template change:
getauditchildren="getchildren(choice.procID)"
To:
getauditchildren="getchildren({ currentNodeId: choice.procID })
Demo: http://plnkr.co/edit/fuMCQ9kSWN6Itxzmehth?p=preview
This does not work when you have multiple levels.
It returns the id of the first level always.
here is a plunker link
getchildren="getauditchildren(currentNodeId)" //should be changed?

Problems with a reusable Click to Edit Directive on AngularJS

I'm using the Reusable Click to Edit Directive from Icelab. I've used it successfully in several places in my app, but I run into problems when I try to edit elements that are inside other directives.
As the directives are calling the elements one by one, as in the following code:
<my-continent text='{{questions.n2A.answer.1.name}}' continent-id="1"></my-continent>
I don't see how can I implement the reusable directive in them, as it generates a general block of html code, not a specific one for each element called with the directive my continent.
I've created a Plunker where the problem is visible.
If I add the click-to-edit directive into my-continent, it breakes. You can see what I mean on line 47 of the html, when I add click-to-edit="questions.n2A.answer.1.name" onto the line as shown under.
<my-continent text='{{questions.n2A.answer.1.name}}' continent-id="1" click-to-edit="questions.n2A.answer.1.name"></my-continent>
Any idea about what am I missing?
Thanks!
I've used your plunker to check your problem and the moment I added click-to-edit to myContinent I've got an error in console linking to this:
Error on AngularJS
So basicly your code is not working because you create new scope in both directives. Hope that helps

Best way to create custom html joomla link

I'm new to Joomla , just want to understanding the best way to implement this.
http://jsfiddle.net/PSYCKIC/JyKJf/
The IDEA is to use that as a link , i click there and lead me to a article or link. (didn't include the javascript in the example)
PROBLEMS :
-I was doing as a custom HTML, but the problem probably have to use javascript for the link but when i save it save without javascript (and probably it a little hardcoded)
- doesnt work for div
LOOKING the best way:
1) Have some ideas , one was to create a module, or something where i just put the image , link of the article and then is always automatically ( but not sure how to import javascript/jquery trough modules ANY HELP? Someone can help me building?)
2) any good module already created for this?
3) Tutorial than can help me understand?
Like a solution where i have possibility to reuse the code not hardcoded.
Thanks in advance.
There are some Joomla extentions which allow to insert into joomla site any code
http://extensions.joomla.org/extensions/edition/custom-code-in-modules/8651
http://extensions.joomla.org/extensions/edition/custom-code-in-modules/2861
If you want to include such code into article, you have to publish module in any position and then use this shotrcode {loadposition _any_position_}.
I hope it will be helpfull
Which Joomla Version are you using?
You have to disable the built in filtering of joomla and your editor:
http://www.tutorials2learn.com/2010/02/cms/fix-tinymce-editor-strips-flash-embed-code-joomla/
for your eitor, go to plugins -> editor -> options -> filter onload ...
you dont need an extra extension for just a simple javascript link

What are some good pop-up dialog boxes for Ruby on Rails

I want to use modal pop-up windows in our web app in Ruby on Rails. Note that I don't want to create a new browser window, but a sub-window inside the existing webpage. We've tried things like TinyBox, but there are issues with returning error information from inside the controller. Any good method or tool that works well in ruby?
There's also prototype-window.
I've never used it myself (not yet at least) but have you tried RedBox?
I'm investigating ModalBox at the moment and it's looking promising.
There's a Google Group and Rails plugin which replaces the basic confirm popup with a modal dialog box.
Try TopUp! It is developed in a Rails application and you can get it from GitHub.
Please note that it is still beta. Feedback is always welcome ;)
Facebox, jquery, that Github use is the best one. There is also a prototype version.
I've used Lightbox Gone Wild for a while now, though I've modified it to display a DIV or other element that's already on the page (though hidden) and then return it to it's parent when the box is closed. I've used it make make Wizards that guide the user through a process.
I've used facebox_render for all my rails projects. It's really easy to use and provided complete helper. You can easily render html or javascript in your RESTful controller.
I have tried several of the ones mentioned above but after twiking it a bit I found that http://www.methods.co.nz/popup/popup.html works better for me, the only problem is that you have create an error routing similar to the one Rails uses, when returning to the popup window with errors the pop up window does not have a way to handle it

Categories