相关疑难解决方法(0)

如果我有jQuery背景,"在AngularJS中思考"?

假设我熟悉在jQuery中开发客户端应用程序,但现在我想开始使用AngularJS.你能描述一下必要的范式转变吗?以下是一些可能有助于您确定答案的问题:

  • 如何以不同方式构建和设计客户端Web应用程序?最大的区别是什么?
  • 我应该停止做什么/使用什么; 我应该开始做什么/使用呢?
  • 是否存在任何服务器端注意事项/限制?

我不是在寻找jQuery和之间的详细比较AngularJS.

javascript jquery angularjs

4518
推荐指数
15
解决办法
81万
查看次数

在angularjs中,jquery的替代方法是什么?

我想从我的应用程序中删除jquery ..但我想在angularjs中替换$ .each ...我怎么能循环dom元素?在这里,我添加了我的代码..我想将它从jquery转换为angularjs

app.directive('activeu', function($location) {
        return function ($scope, element, attrs) {
            var menuMain = $scope.$parent.menuMain;
            var fullpath = $location.path().split('/');
            var current = fullpath[2];

            setTimeout(function() {
                $(".nav li a").each(function() {
                    if ($(this).attr('href') ==  '#!/page/' + current) {
                        $(this).parent().addClass('active');
                        $(this).closest('li.root-li').addClass('active');

                        if ($(this).closest('li.parent').length > 0) {
                            $(this).closest('li.parent').addClass('active');
                        }
                    }
                });

                $(".nav li a").on('click', function() {
                    current = $(this).attr('href');
                    $("#pages-menu .navigation li").each(function() {
                        if ($(this).hasClass('active')) {
                            $(this).removeClass('active');
                        }
                    });

                    $(".nav li a").each(function() {
                        if ($(this).attr('href') ==  current) {
                            $(this).parent().addClass('active');
                            $(this).closest('li.root-li').addClass('active');

                            if ($(this).closest('li.parent').length …
Run Code Online (Sandbox Code Playgroud)

jquery angularjs

26
推荐指数
2
解决办法
3万
查看次数

标签 统计

angularjs ×2

jquery ×2

javascript ×1