我是AngularJS的新手,并尝试创建一个简单的应用程序,允许我将文件上传到我的Laravel驱动的网站.我希望表单向我显示上传项目的预览.所以我使用ng-model来实现这一点,我偶然发现了以下情况:
我有一些基本引导样式的输入,我使用AngularJS模板的自定义括号(因为正如我所提到的,我正在使用Laravel及其叶片系统).我需要从输入中删除空格(当我键入它时)并用短划线替换它们:
<div class="form-group"><input type="text" plaeholder="Title" name="title" class="form-control" ng-model="gnTitle" /></div>
Run Code Online (Sandbox Code Playgroud)
然后我有这个:
<a ng-href="/art/[[gnTitle | spaceless]]" target="_blank">[[gnTitle | lowercase]]</a>
Run Code Online (Sandbox Code Playgroud)
我的app.js看起来像这样:
var app = angular.module('neoperdition',[]);
app.config(function($interpolateProvider){
$interpolateProvider.startSymbol('[[').endSymbol(']]');
});
app.filter('spaceless',function(){
return function(input){
input.replace(' ','-');
}
});
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:TypeError:无法读取未定义的属性'replace'
我知道在过滤之前我需要定义值,但我不确定在哪里定义它.而且,如果我定义它,我不希望它改变我的占位符.
我有这个简单的任务,我已经花了几个小时试图弄清楚如何在我的bash脚本中使用curl调用中的变量:
message="Hello there"
curl -X POST -H 'Content-type: application/json' --data '{"text": "${message}"}'
Run Code Online (Sandbox Code Playgroud)
这是输出$ {message},字面上是因为它在单引号内.如果我更改引号并将double放在外部并且单个内部,则表示找不到命令:Hello,然后找不到命令:那里.
我怎样才能做到这一点?
我的 Web 客户端(以 编写cljs
)连接到后端(以clj
),需要进行一些第三方 API 调用。它必须在服务器上完成,然后结果应该以特定的方式转换并发送回客户端。
这是我的网址之一的处理程序
(defn get-orders [req]
(let [{:keys [sig uri]} (api-signature :get-orders)]
(client/get uri
{:async? true}
(fn [response] {:body "something"})
(fn [exception] {:body "error"}))))
Run Code Online (Sandbox Code Playgroud)
{:body "something"}
它没有返回,而是返回以下错误:
No implementation of method: :render of protocol: #'compojure.response/Renderable found for class: org.apache.http.impl.nio.client.FutureWrapper
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?