相关疑难解决方法(0)

AngularJS $监视窗口调整指令内部的大小

我有暴露模块模式,看起来像这样:

'use strict';

angular.module('app', [])
   .directive('myDirective', ['SomeDep', function (SomeDep) {
       var linker = function (scope, element, attr) {
          // some work
       };

       return {
          link: linker,
          restrict: 'E'
       };
   }])
;
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是将$ watch集成到这里.通过'$ window'服务专门观看窗口调整大小.

[编辑]:

我一直意识到我的问题是什么......当我忘记我将它作为属性实现时,我正在限制元素... @ _ @;

resize directive window watch angularjs

48
推荐指数
2
解决办法
10万
查看次数

angularjs if/else语句和窗口宽度

我是新来AngularJS和最近推出它变成我的应用程序.我想重新写一些我现有的jQuery代码在我的控制器,但是,有一次,我使用:

jQuery的:

if ($(window).width() < 700) {

   $('.productsHeading').on('click', function() {

       $(".productsBody").hide();
       $(".aboutUsBody").show();

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

我可以避开.hide().show()使用ng-hide="productsBody"ng-hide="aboutUsBody"我的DIV内.这些都是经过处理的ng-click="productsheading()".不过,我面临的问题是,我该如何处理:

if ($(window).width() < 700) {
Run Code Online (Sandbox Code Playgroud)

在AngularJS?我使用AngularJS V1.1.5

javascript jquery angularjs angularjs-directive angularjs-scope

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