次の単純なオートコンプリート フォームを検討してください。
<html>
...
<body>
...
<div class='container-fluid' ng-controller="TypeaheadCtrl">
<input type="text"
ng-model="selected" typeahead="name for name in names | filter:{name: $viewValue} | limitTo:8"
typeahead-on-select='onSelect($item, $model, $label)'
class="form-control">
You made this selection {{selection_made}}.
<!-- Run "run_me.sh {{selection_made}} on the server-->
<!-- Render the image that run_me.sh saves to disk on the server --!>
<img ng-src=image.png/>
</div>
<body>
</html>
コントローラーは別の場所で定義されており、入力names
と の定義を担当しonSelect
ます。
サーバー上でシェル スクリプトを呼び出したい:run_me.sh
引数{{selection_made}}
を使用して、サーバーがクライアント上で生成する画像をレンダリングします。
angular + PHP からこれを行うにはどうすればよいですか? これに対する軽量なアプローチはありますか?