我可以很容易地使用ASP/Visual Studio在我的Web应用程序中设置Angular,但我想进入Node世界,更具体地说是Express.我并不是真正理解Express的基本路由处理程序,它将支持Angular的范例.
例如,在设置Express文件时,有一百万个例子,但几乎所有的例子都使用Jade进行模板化,而且我反对Jade的语法并且不想使用它.
到目前为止,我已经为我的Express服务器提供了这个(我已经评论了一些关于我目前做出的决定的问题):
var express = require('express'),
path = require('path');
var app = express();
var env = process.env.NODE_ENV || 'development';
// 1) Is this really necessary if I'm going to utilize Angular routing for views?
app.set('views', path.join(__dirname, '/app/views'));
app.use(express.static(__dirname + '/public'));
// 2) I'm assuming this is the desired pattern for utilizing Angular.
// A catch-all handler that serves up an html file, which will then
// hand off the rest of the routing to Angular?
app.get('*', function(req, res) …Run Code Online (Sandbox Code Playgroud) 在 Drupal 8 中,当你创建一个带有class和data-dialog-type属性的链接时,使用 bootstrap 主题,如下所示:
<a class="use-ajax" data-dialog-type="modal"
href="http://drupal.page/front">text
</a>
Run Code Online (Sandbox Code Playgroud)
您将在#drupal-modal具有这些 html 包装器的元素中打开页面内容:
<div id="drupal-modal" class="modal fade in" tabindex="-1" role="dialog" style="display: block;">
<div class="modal-dialog" role="document">
<div class="modal-content">
Run Code Online (Sandbox Code Playgroud)
这个结构是在:\themes\bootstrap\js\modal.js如何在链接上看到的。
如何修改它以便我可以将类名#drupal-modal从链接传递给元素a.use-ajax?类名文本可以是链接属性的值。
具体来说,我想添加modal-lg或modal-sm类或一些自定义类。
javascript jquery drupal-8 twitter-bootstrap bootstrap-modal
$array = Array(
[FetchedData_I] => 1
[EM_Account_V] => Test 2
[EM_Date_D] => 2015-11-20
[EM_Time_T] => 00:00:00
[Channel_V] =>
[OD_Online_Listing_ID_V] =>
[OD_Item_Name_V] => Item Namesdsd
[OD_Color_V] =>
[OD_Condition_V] =>
[OD_Qty_V] => 1
[OD_Order_Date_D] => 0000-00-00
[OD_Order_Time_T] => 00:00:00
[OD_Ship_By_Date_D] => 0000-00-00
[Comments_Internal_B] =>
);
Run Code Online (Sandbox Code Playgroud)
以上是查询返回的mysql数据,方案是忽略空数据并处理其他数据.
我目前正在使用:
foreach($array as $value) {
if($value!='') {
//Process the other
}
}
Run Code Online (Sandbox Code Playgroud)
在上述情况下,如何检查的时间和日期,如空的数据EM_Time_T,OD_Order_Date_D等等,看看它们是空的?
当PushNotificationData客户端请求以方法建立集线器连接时,我启动了一个计时器。
根据计时器间隔,它确实从数据库中获取记录并推送到客户端。但是当客户端断开连接时,这个计时器必须停止而不是连续拉动。
所以我使用 OnDisconnected 事件来停止计时器。但不幸的是计时器没有停止
这是我的代码:
public class NotifyHub : Hub
{
private string ConnectionId;
private int UserId;
private int UserTypeId;
Timer timer = new Timer();
public override Task OnConnected()
{
ConnectionId = Context.ConnectionId;
return base.OnConnected();
}
public override Task OnDisconnected(bool stopCalled)
{
timer.Stop();
timer.Enabled = false;
//logic code removed for brevity
return base.OnDisconnected(stopCalled);
}
public void PushNotificationData(Int32 userId, Int16 userTypeId)
{
UserId = userId;
UserTypeId = userTypeId;
ConnectionId = Context.ConnectionId;
timer.Elapsed += Timer_Elapsed1;
timer.Interval = 6000;
timer.Enabled …Run Code Online (Sandbox Code Playgroud) 如何使用 graphql-js 在架构中定义片段?
import graphql from 'graphql'
/* how do I do this?
fragment authorInfo on Author {
name
}
*/
Run Code Online (Sandbox Code Playgroud)
例如,要定义作者类型,我会:
import graphql from 'graphql'
export default new graphql.GraphQLObjectType({
description: `An author`,
name: {
description: `The author's legal name.`,
type: GraphQLString
}
}),
name: `Author`
})
Run Code Online (Sandbox Code Playgroud)
所以这里的类型定义是由 生成的GraphQLObjecType。什么函数会生成片段?
我正在 node.js 中构建一个应用程序。
我编写了一个中间件函数钩子,每当有人在我的应用程序上发出 GET 请求时都会执行该钩子,比如他们进入主页、个人资料页面等。该钩子从另一个 API 发出 HTTP 请求以收集数据。
我的问题是如何在客户端访问该数据?这是我的中间件钩子:
var request = require('request');
module.exports = {
authentication: function (req, res, next) {
if (req.method === 'GET') {
console.log('This is a GET request');
request("http://localhost:3000/api/employee", function(err, res, body) {
console.log(res.body);
});
}
next();
}
};
Run Code Online (Sandbox Code Playgroud)
它用于我的所有路线:
app.use(middleware.authentication)
示例路线:
router.get('/', function(req, res, next) {
res.render('../views/home');
});
Run Code Online (Sandbox Code Playgroud)
注意我使用了console.log(res.body),但我想在客户端打印它的内容。有谁知道如何做到这一点?
有没有人知道调整notepad ++主题或查看崇高文本的确切步骤3.有一个链接对我来说并不完全清楚,我正在寻找其他解决方案.
这不是一个重复的问题 - 我不想简单地改变CSS中的字体颜色.
我的问题:
我有颜色的产品.蓝色,红色,绿色,黄色,紫色 - 任何一种颜色.
我有一个颜色相同的盒子 -
在这个盒子里面我有一个按钮"买"
我可以创建这个动态按钮 - 与盒子的颜色相同.
如果框是蓝色 - 按钮为蓝色,带有白色边框和白色字体颜色.
如果框为红色 - 按钮为红色,带有白色边框和白色字体颜色.
CSS(反向按钮):
.btn-inv {
color: #ffffff !important;
background-color: transparent;
border: 1px #ffffff solid;
box-shadow: none;
}
Run Code Online (Sandbox Code Playgroud)
但是在悬停中
.btn-inv:hover {
color: #000000;
background-color: #ffffff;
border: 1px #ffffff solid;
}
Run Code Online (Sandbox Code Playgroud)
按钮变为白色 - 字体颜色变为黑色.
问题:我需要在盒子的同一颜色的前色 - 如果盒子是蓝色,字体颜色是蓝色.
当然 - 如果我改变CSS - 我可以这样做.
但我需要一种动态的方法来做到这一点 - 因为我无法创建所有按钮颜色..
使用"风格"的东西:
<a href="#" class="btn btn-inv btn-lg" style=".HOVER: color: #4a62ab">BUY</a>
Run Code Online (Sandbox Code Playgroud)
或标签内部颜色的任何其他ideia.因为有了这个,我可以简单地发送正确的颜色信息并动态创建按钮.
如果我有80种颜色 - 我可以使用相同的CSS进行全部 - 只需通过ASP发送正确的动态完成按钮.
而且我不需要因此而创建80个CSS按钮.
[{ Url: 'http://example.com', Shortname: 'shortname', Name: 'nameaaa' }, { Url: 'fsadfsad', Shortname: 'aaa', Name: 'fasfsad' } ]
Run Code Online (Sandbox Code Playgroud)
谢谢。
是否可以使用如下所示的语句来定义方法而不使用prototype?
Person.sayHello = function () {...}
Run Code Online (Sandbox Code Playgroud)
在这个例子中
var Person = function (firstName) {
this.firstName = firstName;
};
Person.prototype.sayHello = function() {
console.log("Hello, I'm " + this.firstName);
};
var person1 = new Person("Alice");
var person2 = new Person("Bob");
Run Code Online (Sandbox Code Playgroud) 这是我想从中获取价值的代码。我没有身份证,所以请帮助我。如何使用 jQuery 和 JavaScript 获取值?
<p>Nama*<br />
<span class="wpcf7-form-control-wrap your-name">
<input type="text" name="your-name" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required form-control" aria-required="true" aria-invalid="false" />
</span>
</p>
<p>Email*<br />
<span class="wpcf7-form-control-wrap your-email">
<input type="email" name="your-email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email form-control" aria-required="true" aria-invalid="false" />
</span>
</p>
<p>Pertanyaan/Cerita*<br />
<span class="wpcf7-form-control-wrap your-message">
<textarea name="your-message" cols="40" rows="10" class="wpcf7-form-control wpcf7-textarea wpcf7-validates-as-required form-control" aria-required="true" aria-invalid="false"></textarea>
</span>
</p>
<p>
<input type="submit" value="Send" class="wpcf7-form-control wpcf7-submit" />
</p>
Run Code Online (Sandbox Code Playgroud) javascript ×8
jquery ×3
express ×2
node.js ×2
angularjs ×1
asp.net ×1
c# ×1
css ×1
drupal-8 ×1
ejs ×1
graphql ×1
graphql-js ×1
html ×1
middleware ×1
mysql ×1
php ×1
signalr ×1
sublimetext3 ×1
themes ×1
timer ×1