1
再次我......我卡住了。我需要在我的项目中使用Angular.JS,但我无法在动态生成的标签中运行Angular。Angular.JS动态jQuery
<h1>Your albums</h1><hr/>
<div ng-controller="AlbumsController">
<ul>
<li ng-repeat="album in albums">
{{album.name}}
<p>{{album.desc}}</p>
</li>
</ul>
</div>
这是通过JQuery动态生成的块。
<html ng-app="Application" class="no-js" lang="ru">
这是标记静态,它必须初始角。
我的动态块不起作用。它返回:{{album.name}} {{album.desc}},这就是未初始化 Angular.JS :(
var Juster = angular.module('Juster', []);
Juster.controller('AlbumsController', function ($scope) {
$.post("/index.php/profile_ctrl/myalbums", function(data){
$scope.albums = data;
})
});
你能告诉我们你的Controller/Js? –
var Juster = angular.module('Juster',[]); Juster.controller( 'AlbumsController',函数($范围){$ .post的( “/ index.php的/ profile_ctrl/myalbums”,功能(数据){$ = scope.albums数据; }) } ); 所以,html: – user3169724
在我记起Angular之后,我开始在JQuery上创建项目。它有助于简单显示json – user3169724