小编kmm*_*kmm的帖子

让Angular Bootstrap手风琴工作

我没有运气从这个回购中获得手风琴:https://github.com/angular-ui/bootstrap

似乎标题没有出现,我不知道为什么.

HTML:

<!doctype html>
<html ng-app="myApp">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Angular UI Test</title>
    <meta charset="utf-8" />
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script>
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" />
    <script src="https://raw.github.com/angular-ui/bootstrap/master/src/accordion/accordion.js"></script>
    <script src="app.js"></script>
    <style type="text/css">
        .wrap {width:960px;margin:0 auto;}
    </style>
</head>
<body>
    <div class="wrap" ng-controller="MyCtrl">
        <accordion>
            <accordion-group title="Title">This has a one word title.</accordion-group>
            <accordion-group title="Title2">This also has a one word title.</accordion-group>
            <accordion-group title="Title With Spaces">This has a title with spaces!</accordion-group>
        </accordion>
    </div>
</body>
Run Code Online (Sandbox Code Playgroud)

JS:

var myApp = angular.module('myApp',['ui.bootstrap.accordion']);

function MyCtrl($scope) {
}
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui

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

使用侧边栏阻止语义 UI 溢出内容

我在我的页面上使用语义 UI 侧边栏进行导航。默认情况下,我想让它可见,并且用户可以选择关闭它(如果他们愿意)。问题是,通过默认打开侧边栏,我的页面内容被推离屏幕并溢出,因此页面的一部分被切断。在文档中没有看到任何关于使页面内容符合可用宽度而不是被推离屏幕的内容。

$('.toggler').on('click', function() {
	$('.ui.sidebar').sidebar('toggle');
});
Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Semantic UI Sidebar test</title>
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.4/semantic.min.css">
</head>
<body>
  <div class="ui left sidebar inverted vertical menu visible pushable">
  <a href="#" class="item">Sidebar Link</a>
</div>
<div class="ui pusher">
  <div class="ui menu">
    <a class="item toggler">
      Toggle
    </a>
    <div class="item header">
      Semantic UI
    </div>
      <div class="menu right">
          <a href="#" class="item">Test</a>
      </div>
  </div>
  <div class="ui segment">
    <table class="ui celled table">
  <thead>
    <tr><th>Header</th>
    <th>Header</th>
    <th>Header</th>
  </tr></thead>
  <tbody>
    <tr>
      <td>
        <div …
Run Code Online (Sandbox Code Playgroud)

javascript css user-interface semantic-ui

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

Django API请求

我正在尝试访问其他服务的API,使用我的模型字段作为API请求中的关键字.URL就像这样:

http://api.example.com/json/?first_name=FNAME&last_name=LNAME&key={key}
Run Code Online (Sandbox Code Playgroud)

这是来自views.py的代码:

class ExamplePersonView(ListView):

    context_object_name = "example_person"
    template_name = "templates/example_person.html"

    def get_queryset(self):
        lname = get_object_or_404(ExamplePeople, lname__iexact=self.args[0])
        return ExamplePeople.objects.filter(lname=lname)
Run Code Online (Sandbox Code Playgroud)

根据我的理解,我需要使用AJAX在我的页面模板和views.py之间进行通信,以发送请求,然后在页面上显示信息.

我发现了几个Django应用程序,可以很容易地将您的模型转换为公共API,但没有一个可以帮助您从其他服务访问API.有谁知道这样的应用程序?

如果没有,是否有人很好地理解使用AJAX与Django发出请求并将其呈现在模板中?

api django ajax

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