草庐IT

angularjs-ng-include

全部标签

javascript - 如何在 AngularJS 中将消息从一个 Controller 发送到另一个 Controller ?

我有以下设置:stApp.controller('AdminTableController',['$rootScope','$scope','gridService',function($rootScope,$scope,gridService){$scope.$watch('tableData.$pristine',function(newValue){$rootScope.broadcast("tableDataUpdated",{state:page.$pristine});});}])stApp.controller('AdminGridController',['$rootS

javascript - jQuery 不适用于 ng-repeat 结果

我正在使用ng-repeat使用jQuery和TB构建Accordion。出于某种原因,这在硬编码时工作完美,但在ng-repeat指令内部时无法触发点击。我认为问题出在jQuery没有绑定(bind)事后加载的元素。因此,我认为与其在页面加载时加载脚本,不如在返回数据时在.success上加载函数会更好。不幸的是,我不知道如何进行这项工作。测试页:http://staging.converge.io/test-jsonController:functionFetchCtrl($scope,$http,$templateCache){$scope.method='GET';$scope

javascript - 在滚动事件 AngularJS 之后在 Controller 中执行函数

假设我有一个堆叠的文章供稿:{{article.title}}{{article.body}}滚动浏览每篇文章时:...我想执行一个函数:.controller('AppCtrl',['$scope',function($scope){$scope.atNewArticle=function(){console.log(article);}}])我很难找到执行此操作的正确方法,因为我不确定是否应该将滚动事件绑定(bind)到窗口或检测指令元素本身的偏移量。到目前为止,这是我尝试过的:http://jsfiddle.net/6VFJs/1/ 最佳答案

javascript - Angular ng-disabled 功能

我想将disabled-ng与函数返回的动态值一起使用。我尝试了几种方法,但都不行。............使用这个javascript函数$scope.prova=function(e){returntrue;}; 最佳答案 试试这个语法:ng-disabled="prova()"示例:http://jsfiddle.net/3eqz2/2/ 关于javascript-Angularng-disabled功能,我们在StackOverflow上找到一个类似的问题:

javascript - 在 AngularJS 中使用来自不同 Controller 的 $scope 函数

这个问题在这里已经有了答案:CanoneAngularJScontrollercallanother?(14个答案)关闭9年前。我想在另一个Controller中共享一个Controller的$scope函数,在本例中为AngularUI对话框。特别是在下面的示例中,我希望$scope.scopeVar在PopupCtrl中可用。HereisaPlunkrResolvecodebasedonmlarcher'scommenthere主要.jsangular.module('MyApp',['ui.bootstrap']);varMainCtrl=['$scope','$dialog',

javascript - 在 AngularJS 中使用 iFrame

使用Angular1.2+,我正在尝试制定一种“有Angular”的方式来加载iFrame,但我在任何地方都找不到任何教程/任何真正的讨论。基本上,我有一个显示链接列表的搜索页面。单击链接应调用我的Controller中的函数,该函数将数据(可能通过$http服务?)加载到iFrame,同时保持搜索结果可见。这是一些基本代码(我之前从未真正使用过iFrames,如果这完全错误,我深表歉意)查看Here'salink!Controller$scope.itemDetail=function(link){$scope.itemShown=true;$scope.busy=true;$htt

javascript - AngularJS ng-disabled 不使用列表项

我在禁用列表中的项目时遇到问题。list1list2list3它不适用于ng-disabled。我也尝试过:list2它也不起作用。任何人都可以提出建议吗? 最佳答案 我猜您想在someCondition为真时禁用onclick。这应该有效:list1list2list3因此,如果someCondition为真,则不会执行changeStatus(),因为OR语句在前一条语句已经为真时不会执行下一条语句。 关于javascript-AngularJSng-disabled不使用列表项,我

javascript - angularjs $scope.$apply() 给出此错误 : Error: [$rootScope:inprog]

我正在尝试更新属于$scope的页面上的一些文本。但我不断收到此错误:Error:[$rootScope:inprog][http://errors.angularjs.org/1.2.15/$rootScope/inprog?p0=%24apply][1]atError(native)athttps://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js:6:450atm(https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js:1

javascript - AngularJS 指令出错 - 无法读取未定义的属性 'compile'

AngularJS的新手并尝试创建一个简单的指令。代码失败并显示类型错误:无法读取未定义的属性“编译”。任何建议将不胜感激。JSvarxx=angular.module('myApp',[]);xx.directive('myFoo',function(){return{template:'23'};});HTML您可以在此处找到代码和错误https://jsfiddle.net/p11qqrxx/15/ 最佳答案 这只是你的返回声明。差:return{}//Thisreturnsundefined,returnisoddanddo

javascript - Angular JS : binding in ng-show not working

我有一个指令和一个Controller:app.directive('responseBox',function(){return{restrict:'E',transclude:true,templateUrl:'responseBox.html',link:function(scope,element,attrs){element.bind("click",function(){scope.toggle();})}}});和一个Controller:app.controller('responseBoxCtrl',function($scope){$scope.opened=fal