gpt4 book ai didi

javascript - ng-repeat 禁用我的 div

转载 作者:行者123 更新时间:2023-12-03 11:24:35 24 4
gpt4 key购买 nike

我在我的舞台上必须修改一个网站,因为我需要 angularjs 我想使用命令 ng-repeat 来显示一些文档,但是当我在 div 中添加 ng-repeat 时,它会“破坏”它,我无法理解知道为什么...所以有代码希望你能帮助我。这是我的js

App.controller('doccontroller', [ function(){
return {
scope: {},
restrict: 'A',
link: function ($scope){
$scope.docs = [
{
"id_section" : 0,
"description": "RANDOM STUFF",
"source": [
{
"python": "TEXTE",
"ruby": "TEXTE",
"javascript": "TEXTE"
}
]
},

{
"id_section" : 1,
"description": "RANDOM STUFF",
"source": [
{
"python": "TEXTE",
"ruby": "TEXTE",
"javascript": "TEXTE"
}
]
},

{
"id_section" : 2,
"description": "RANDOM STUFF",
"source": [
{
"python": "TEXTE",
"ruby": "TEXTE",
"javascript": "TEXTE"
}
]
}
]
}
}
}

])

`这是我“包含” Controller 的路线

$routeProvider.when '/docs',
templateUrl : config.BaseHtml+'/Page/docs.html'
controller : 'doccontroller'

`并完成 html:)

<div id="api-docs">
<div id="methods">
<div class="languages">
<a class="language selected" data-lang="ruby" href="#">Ruby</a>
<a class="language" data-lang="python" href="#">Python</a>
<a class="language" data-lang="php" href="#">PHP</a>
</div>
<div>
<div class="method" id="intro">
<div class="method-section clearfix">
<div class="method-description" ng-repeat="doc in docs">
<h3>Introduction</h3>
<p>
{{doc.description}}
</p>
</div>
<div class="method-example">
<pre>
<code class="ruby"># All this code is just folololol

React.api_key = "In here goes your api key!"</code><code class="python"># All this code is just for demonstration purposes

react.api_key = "In here goes your api key!"</code><code class="php"># All this code is just for demonstration purposes

React::setApiKey("In here goes your api key!");</code>
</pre>
</div>
</div>
</div>
</div>
</div>
</div>

所以再说一遍,我需要做的是填充创建 1 div/id_section 并用暂时描述一下。

最佳答案

更改:

ng-repeat="文档中的文档"

至:

ng-repeat="文档中的文档"

此外,在您的代码中您还调用了 {{ doc.des }},它可能应该是 {{ doc.description }}

关于javascript - ng-repeat 禁用我的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26978236/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com