小编can*_*mik的帖子

如何使用AngularJS将div向左滚动

我有一个如下所示的div:

<div class="col-xs-1 scroll-button"><i class="glyphicon glyphicon-chevron-left"></i> </div>
<div class="customer-ust-bant col-xs-22" id="letters">
    <box ng-repeat="lt in alph" name="{{lt}}" id="{{lt}}"></box>
</div>
<div class="col-xs-1 scroll-button" ng-click="gotoBottom()"><i class="glyphicon glyphicon-chevron-right"></i> </div>
Run Code Online (Sandbox Code Playgroud)

和框模板:

<div class="alphabet-kutu">{{name|uppercase}}</div>
Run Code Online (Sandbox Code Playgroud)

和指令:

app.directive("box", function() {
return {
    restrict:"E",
    scope:{
        name:"@"
    },
    templateUrl:"/static/templates/customers/box.html",
    link:function(scope,elem,attrs,ctrl) {

    }
  };
})
Run Code Online (Sandbox Code Playgroud)

如你所见,我有div包含字母表中的字母和水平滚动样式.

单击按钮时,我想将此div向左滚动.

 $scope.gotoBottom = function (){
var element = angular.element( document.querySelector( '#letters' ) );
    element.animate({scrollLeft: element.offset().left}, "slow");
    //element.scrollLeft(100);

};
Run Code Online (Sandbox Code Playgroud)

我尝试了animate和scrollLeft函数.但我没有做任何好事.在这种情况下,AngularJS中是否有特殊功能?如何使用jQuery将div向左滚动?

css jquery angularjs

9
推荐指数
1
解决办法
2909
查看次数

mongoengine参考字段查询

我正在建造一个使用烧瓶架和mongoengine的餐厅预订网站.

我的主要目标是使用json获取客户id等于所需客户ID的所有预留对象

data = rzv.objects(restaurant=rest, customer=cdb.objects.get(id=request.args.get("customer-reservation"))).all()
Run Code Online (Sandbox Code Playgroud)

当我尝试触发此查询时,json给了我一个错误:

mongoengine.errors.InvalidQueryError
Run Code Online (Sandbox Code Playgroud)

我的预订模型如下:

class Reservations(document.Document):
    restaurant = fields.ReferenceField(Restaurant)
    customer = fields.ReferenceField(Customers)
    shift_type = fields.EmbeddedDocumentField(Shifts)
    room = fields.ReferenceField(Rooms)
    time = fields.StringField()
    covers = fields.IntField()
    status = fields.StringField(default="wait")
    desk = fields.EmbeddedDocumentField(Desks)
    date = fields.DateTimeField()
    sit_date = fields.DateTimeField()
    end_sit_date = fields.DateTimeField()
    cancel_date = fields.DateTimeField()
Run Code Online (Sandbox Code Playgroud)

我的客户模型如下:

class Customers(document.Document):
    title = fields.StringField()
    full_name = fields.StringField()
    first_name = fields.StringField()
    last_name = fields.StringField()
    telephone = fields.StringField()
    visits = fields.StringField()
Run Code Online (Sandbox Code Playgroud)

JSON:

$.getJSON("?customer-reservation=" + $(this).attr("data-id"), function (data) {
            console.log(data);
            reservationFill(data);
        });
Run Code Online (Sandbox Code Playgroud)

最后是观点:

    if …
Run Code Online (Sandbox Code Playgroud)

python json mongodb mongoengine

7
推荐指数
1
解决办法
9845
查看次数

python2.7运行良好时python 3.3的缩进错误

我在下面编写了这个脚本,它将数字转换成它的拼写.

no = raw_input("Enter a number: ")

strcheck = str(no)
try:
     val = int(no)
except ValueError:
     print("sayi degil")
     raise SystemExit
lencheck = str(no)
if len(lencheck) > 6:
     print("Bu sayi cok buyuk !")
     raise SystemExit

n = int(no)
print(n)
def int2word(n):

     n3 = []
     r1 = ""

     ns = str(n)
     for k in range(3, 33, 3):
              r = ns[-k:]
              q = len(ns) - k

    if q < -2:
        break
    else:
        if  q >= 0:
            n3.append(int(r[:3]))
        elif q >= -1:
            n3.append(int(r[:2]))
        elif …
Run Code Online (Sandbox Code Playgroud)

python python-2.7 python-3.3

5
推荐指数
1
解决办法
1万
查看次数

用于存储静态网站子目录的 Azure CDN 高级 Verizon 规则引擎 V4 URL 重写

我正在尝试主持一个Angular项目Azure Storage Static Website Azure CDN Verizon Premium

假设我为每个Angular构建都有名为类似的容器v0.3.13.3,并且在该容器中还有角度项目的多语言构建。

我想要实现的是index.html为每个版本和语言提供正确的路由。

您可能会在下面找到示例路线:

my.domain.com/v0.3.13.3应该服务/v0.3.13.3/index.html
my.domain.com/v0.3.13.3/dashboard应该服务/v0.3.13.3/index.html
my.domain.com/v0.3.13.3/fr应该服务/v0.3.13.3/fr/index.html
my.domain.com/v0.3.13.3/fr/dashboard应该服务/v0.3.13.3/fr/index.html

我已经成功地做到了,Azure Standard Rules Engine 如下面的屏幕截图所示。

在此输入图像描述

但据我从文档中看到,在标准规则引擎Contains字段中不能用正则表达式填充。我已经在谷歌上进行了挖掘,但似乎找不到任何适合我的解决方案。

因此,我已将 CDN 服务切换为 Verizon Premium 并尝试应用于(v(?:(\d+)\.)?(?:(\d+)\.)?(?:(\d+)\.\d+))路径正则表达式。

我在使用 Verizon Premium 时遇到的主要问题是,只有URL Rewrite在我将 IF 字段声明为Always

在此输入图像描述

如您所见,URL Rewrite未列出。

我还使用声明进行了几次部署Always ,但没有任何好处。

每个人在博客中分享的唯一示例

在此输入图像描述

所以上面的例子不包括文件扩展名和子路由。

有什么方法可以实现我的目标吗?

提前致谢。

azure-cdn azure-blob-storage verizon

5
推荐指数
1
解决办法
2125
查看次数

无法访问php中的帖子

这是我的代码.这段代码无法访问帖子,我不知道为什么.

if ($_POST) {
echo 'post a girdim';
}
?>
<html>
   <head>

   </head>
<body>
    <form action="" method="post">
        <input type="submit">
    </form>
</body>
Run Code Online (Sandbox Code Playgroud)

php forms

1
推荐指数
1
解决办法
120
查看次数