I use the Mean-Stack SPA start from scotch.io.
For dialogs I use ng-dialog.
For forms I want to use angular-formly.
I call in the MainCtrl ng-dialog.open to own searchdialog.html.
In the searchdialog.html I want replace a form with angular-formly.
A normal form shows up in the dialog, the formly-coded part does not show up, only the submit-button.
The code is here JS BIN link
Why the formly-form does not show up, but normal forms show up?
EDIT: I added my complete testcode here
GithubCode
The problem you're having is that you're not including the angular-formly library (or even angular) on the page. You'll need to do that first. Also, you're not depending on the angular-formly module 'formly' in your module definition.
If you're not already familiar with how to depend on third-party modules in your angular code, I recommend you read the documentation on Angular modules. Then, follow the getting started instructions on the angular-formly docs. Then take a look at the examples from the angular-formly website. You'll notice that they all include the angular-formly library as script tags. If you'll be using normal script tags, you'll want to download those dependencies and add them to your project.
Good luck!
Related
I need to write a plugin that needs to create table in database and some setting from installation form. I can easily create form but I have difficulty to run the script after installation to read options and create table. Is it possible at all to run such simple script or maybe you need to create everything like for example models, vehicles and so on?
I would appreciate if anyone could give me directions how to do it. Modx documentation is not clear about this and https://github.com/splittingred/Doodles/tree/production sample repo contains multiple elements I'm not familiar with and I believe don't need at all
Typically you'd use a resolver to run code after the install.
While in the question comments the setup options are discussed, the package attributes there are actually executed to generate the setup options form, not to process the results.
The docs are a tad dated (mostly the screenshots), but Creating a 3rd party build script explains the different parts of a build script, and what they're for, with a fair bit of examples.
The piece you're looking for is this:
$vehicle->resolve('php',array(
'source' => $sources['resolvers'] . 'setupoptions.resolver.php',
));
You'll need to have a $vehicle (perhaps from a category or other object you're adding to the build) and the file in the provided location. Inside the resolver file you can use $object->xpdo as an instance of the modX class to do your thing.
I am developing a plugin, that inserts some JS code into every page of OpenCart. This code needs some variables, that are set in admin part of module (this part is already finished). But now I need to modify template, that on every page there would be a HTML snippet with my code inserted.
I have gone through many tutorials (most of them were for OpenCart 1.X) and did not find anything about how to do this.
Also I would prefer not to change OpenCart's core code, like some modules do, if possible.
I’m building an electron app. In it, I have a webview with a preload script. Inside said script, I’d like to use sweetalert.
I installed sweetalert with npm install --save sweetalert. Inside my script I load it with require('sweetalert') and call it with swal("Hello world!");. I now notice it doesn’t look right, as the alert is missing its required CSS file. But I’m loading it with require('sweetalert'), which is great since sweetalert can just remain in its directory inside node_modules and I don’t have to care for it, but its CSS is an integral part of it, and is not getting pulled the same way.
Now, what is the recommended way of solving this? Keep in mind I’m inside a javascript file and would like to remain that way. Do I really have to go get the CSS file and inject it in some way? And how would I do it correctly, since it is inside node_modules? After testing it, it seems like it can’t be done in this particular case due to Content Security Policy.
Either way, that seems so clunky in comparison to the require statement, it’d seem weird for a simpler solution to not be available.
You'll have to include it like you would normally do in a browser, for example in index.html. Copy it out of the module folder into your css folder if you have one and link it with the link tag. It depends on if you're using plain electron or some other boilerplate template with there is a gulp/grunt workflow on where to stick it but that's it really, electron is just a browser that's running your JS/html so it's really the exact same process. require only loads the JS module but not the styles.
if you wanted to include it dynamically you could use the same techniques as a regular browser for example (ex. document.write/create element).
I'm not familiar with sweetalert, but hopefully this helps.
Your syntax for require should be something similar to this.
var sweetalert = require('sweetalert')
You should then be able to access methods on the sweetalert object using the following syntax.
sweetalert.someMethod()
Remember requiring just returns a javascript object. Those objects usually have methods that will allow certain functionality. If you want to add sweetalert to your page, you will either need to inject it within the html, or the javascript within the sweetalert module will need to dynamically create html where the css is included. I hope that clarifies some things and helps you get a better sense of some of the inner workings.
For example, if I'd like to read the source code of the process.chdir JavaScript function, how can I do that?
I can find process.js on github but not sure that's the right file. Is there an easier way to navigate from docs directly to source?
There is not a simple way to navigate directly from the web doc to source. To find the code for a specific function, you have several choices:
Create a small test app that calls the function in question, run node-inspector and step into the function of interest. That will take you right into the source code that your installed version of node.js is running. You can then continue stepping or just examine the local source code shown in the debugger.
Grep your own node.js installation. Since all the .js files are right there and in plain text, you can find it there.
Go to Github like you've done and find the relevant function. This is not always easy to do (as you've discovered) and it doesn't guarantee that you're looking at the source for the exact same version you have installed. If you're a Github wiz, you can always figure out how to see the right version, but that's a bit more work.
If the code you want is actually implemented in native code, then you're going to have to use options 3 or maybe option 2 (if you have native sources locally).
I was wondering what people are using for generating breadcrumbs in drupal. I've seen various modules and was wondering which ones people have had success with.
Thanks for any thoughts.
Bad news from me: personally I always custom-write breadcrumb code because every professional job I do has different requirements and no generic breadcrumb module can do it all.
I used to create a hook_preprocess_page function then issued my own hook to see if any module would like to rebuild the breadcrumbs - I do it this way so that, for instance, if I have a specialised node I can put the breadcrumb-building code for that node type into its support module (and not try to cram it all into one ever-expanding function - it's the Drupal Way).
Nowadays I use ctools plugins instead of a module hook in the hook_preprocess_page since you can do additional clever stuff.
(If using Panels you'd have to create a new breadcrumb panel pane and work from there. Word to the wise: Panels destroys $_GET['q'] which can make it harder to build breadcrumbs in some situations.)