我一直在寻找在启用"服务器端渲染"的服务器上托管Angular 4应用程序大约3个小时.注意 - 我有一台安装了Apache的AWS服务器(Ubuntu).
首先,我已经知道如何托管Angular 4应用程序(没有服务器端渲染).但是我的主要关注点是我想启用我的应用程序 - 服务器端渲染.
在我的本地,我使用npm start
命令,它自动提供应用程序(启用服务器端渲染) -http://localhost:4000
我的package.json
文件看起来像这样:
...
"scripts": {
"serve": "ng serve",
"prestart": "ng build --prod && ngc && webpack",
"start": "node dist/server.js",
"build": "ng build"
},
...
Run Code Online (Sandbox Code Playgroud)
这些命令都运行正常.但我很困惑,我应该再次参加比赛
npm start
Run Code Online (Sandbox Code Playgroud)
在生产服务器上,因此它还需要node_modules
安装.这对我来说似乎不是正确的方法?
任何人都可以帮助我托管我的应用程序启用"服务器端呈现".
我是 Retrofit Library 的新手。我正在开发一个应用程序,我必须在其中进行多个 API 调用,但是当我尝试进行第一个 API 调用时,这个问题一直困扰着我......
我面临的问题是,每当我曾经调用改造的异步调用方法时,onResponse 方法中的功能就会运行 2 次...
这是我异步调用 API 时的代码...
final ApiModule apiService = ApiServiceGenerator.createService(ApiModule.class);
Call <ConfigResponse> call = apiService.getConfig();
call.enqueue(new Callback<ConfigResponse>() {
@Override
public void onResponse(Call<ConfigResponse> call, Response<ConfigResponse> response) {
try {
if (response.isSuccessful()) {
Log.e("MyTag", "This is running");
}
} catch(Exception e) {
e.printStackTrace();
}
}
@Override
public void onFailure(Call<ConfigResponse> call, Throwable t) {
e.printStackTrace();
}
});
Run Code Online (Sandbox Code Playgroud)
一旦我在设备上运行应用程序,当我看到我的 android studio 的记录器时,它就会向我显示日志消息 -
E/MyTag: This is running
E/MyTag: This is running
Run Code Online (Sandbox Code Playgroud)
似乎在这里运行了 2 次.. …
我有我的模态:
<div id="defaultModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-title" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 class="modal-title" id="modal-title">Modal Title</h3>
</div>
<div class="modal-body" data-table="table" data-id="">
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我有我的按钮:
<button href="page.php" data-title="New Data" class='call-modal btn btn-success' >
<i class="glyphicon glyphicon-plus"></i>
</button>
Run Code Online (Sandbox Code Playgroud)
点击按钮后我使用"call-modal"类:
$('.call-modal').on('click', function(e){
e.preventDefault();
$('#defaultModal')
.find('.modal-header > h3').text("Teste").end()
.find('.modal-body').load($(this).attr('href')).end()
.modal('show');
});
Run Code Online (Sandbox Code Playgroud)
我可以加载内容,但我想使用数据标题设置标题.
知道为什么它不起作用吗?
谢谢
来自作曲家我从laravel/lumen创建了一个项目.我没有评论路由中间件
$app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class,
]);`
Run Code Online (Sandbox Code Playgroud)
我的路线添加了auth中间件.
$app->get('/', ['middleware'=>'auth'], function () use ($app) {
return $app->version();
});
Run Code Online (Sandbox Code Playgroud)
我明白了 ErrorException in RoutesRequests.php line 656: Undefined variable: closure
我用谷歌搜索了这个接缝是5.2中的一个问题,但我已经下载了5.3.没有我得到的中间件Lumen (5.3.3) (Laravel Components 5.3.*)
我的代码是 -
<GridLayout
xmlns:android= "http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:columnCount="4"
android:orientation="horizontal" >
<Button android:text="@string/btn7" />
<Button android:text="@string/btn8" />
<Button android:text="@string/btn9" />
<Button android:text="@string/btndiv" />
<Button android:text="@string/btn4" />
<Button android:text="@string/btn5" />
<Button android:text="@string/btn6" />
<Button android:text="@string/btnmul" />
<Button android:text="@string/btn1" />
<Button android:text="@string/btn2" />
<Button android:text="@string/btn3" />
<Button android:text="@string/btnmin" />
<Button android:text="@string/btn00" />
<Button android:text="@string/btn0" />
<Button android:text="@string/btndec" />
<Button android:text="@string/btnadd" />
<Button android:text="@string/btnsqrt" />
<Button android:text="@string/btncbrt" />
<Button android:text="@string/btnrec" />
<Button
android:layout_gravity="fill"
android:layout_rowSpan="2"
android:text="@string/btneql" />
<Button android:text="@string/btnpow" />
<Button android:text="@string/btnper" />
<Button …
Run Code Online (Sandbox Code Playgroud) 好吧,我有这个页面
domain.com/bla.php?p[]=1&p[]=2&p[]=3&p[]=4
Run Code Online (Sandbox Code Playgroud)
现在,$_GET['p']
按预期工作.这是一个阵列
然而,filter_input(INPUT_GET, 'p')
产生false
.
现在我该怎样得到的数组值p
使用filter_input