Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understood this correctly you want a click on the client-side (angular app) to call a batch file on the server side. You can do this in several ways depending on your requirements, but basically you want the client-side to send a http-request to the server (either with ajax call or form submit) and process this on the server that will call the batch file.</p> <h2>Client-side</h2> <p>On the client-side you need to have a button that uses the angular <a href="http://docs.angularjs.org/api/ng.directive:ngClick" rel="nofollow noreferrer"><code>ng-click</code></a> directive:</p> <pre><code>&lt;button ng-click="batchfile()"&gt;Click me!&lt;/button&gt; </code></pre> <p>In your angular controller you'll need to use the <a href="http://docs.angularjs.org/api/ng.$http" rel="nofollow noreferrer">$http service</a> to make a HTTP GET request to your server on some particular url. What that url is depends how you've set up your express app. Something like this:</p> <pre><code>function MyCtrl($scope, $http) { // $http is injected by angular's IOC implementation // other functions and controller stuff is here... // this is called when button is clicked $scope.batchfile = function() { $http.get('/performbatch').success(function() { // url was called successfully, do something // maybe indicate in the UI that the batch file is // executed... }); } } </code></pre> <p>You can validate that this HTTP GET request is made by using e.g. your browser's developer tools such as <a href="https://developers.google.com/chrome-developer-tools/docs/network" rel="nofollow noreferrer">Google Chrome's network tab</a> or a http packet sniffer such as <a href="http://fiddler2.com/" rel="nofollow noreferrer">fiddler</a>.</p> <h2>Server-side</h2> <p><strong>EDIT: I incorrectly assumed that angular-seed was using expressjs, which it doesn't. See <a href="https://stackoverflow.com/a/18328123/3713">basti1302's answer on how to set it up server-side "vanilla style" node.js</a>. If you're using express you can continue below.</strong></p> <p>On the server side you need to <a href="http://expressjs.com/api.html#express" rel="nofollow noreferrer">set up the url in your express app</a> that will perform the batch file call. Since we let the client-side above make a simple HTTP GET request to <code>/performbatch</code> we'll set it up that way:</p> <pre><code>app.get('/performbatch', function(req, res){ // is called when /performbatch is requested from any client // ... call the function that executes the batch file from your node app }); </code></pre> <p>Calling the batch file is done in some ways but you can read the stackoverflow answer here for a solution:</p> <ul> <li><a href="https://stackoverflow.com/q/14458508/3713">node.js shell command execution</a></li> </ul> <p>Hope this helps</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload