草庐IT

ng2-dragula

全部标签

javascript - ng-include 中的指令

我正在构建一个简单的angularjs应用程序,我正在尝试在不刷新页面的情况下实现登录。我在做什么在初始化时,ng-include加载/set/save。/set/save得到了LoginwithFacebook在里面。因此,当单击该指令时,它会打开一个窗口,当该窗口关闭时,它应该更改ng-include的src。问题当指令在ng-include中使用时(ng-includesrc在init上有默认值),没有任何反应(控制台中没有错误,什么都没有),但是当我将指令放在ng-include之外时它正在工作很好(见下面的HTML代码)HTML:........testCase//^this

javascript - 使用 AngularJs ng-repeat 对项目详细信息进行分组

我想在ng-repeat中按函数执行分组给定以下数据:varitems=[];items.push({id:1,widgetId:54,colorId:45});items.push({id:2,widgetId:54,colorId:72});items.push({id:3,widgetId:54,colorId:29});items.push({id:4,widgetId:55,colorId:67});items.push({id:5,widgetId:55,colorId:29});items.push({id:6,widgetId:56,colorId:29});items

javascript - ng-repeat 中的新元素动画

我正在使用具有某种风格的ng-repeat,我将向数组中添加新元素。这就是我所做的://Codegoesherevar_app=angular.module("userApp",[])_app.controller("usrController",function($scope){$scope.usrList=[];$scope.adduser=function(){console.log($scope.newUsr)$scope.usrList.push({name:$scope.newUsr})}})/*Stylesgohere*/.listItem{border:1pxsolid

javascript - 单击列表中的每个单选按钮后 ng-change 不触发

我正在为我的大学项目创建一个小应用程序,我有一个场景,当用户点击一个单选按钮时,应该触发一个事件。我的Angular代码块:{{count+1}}.{{q.questionText}}{{d.choiceText}}在我的Controller中,我有这段代码:$scope.correctAnswer={isCorrect:false};$scope.getDetails=function(index,choiceList,isCorrect){/*somelogic...*/}事件每个按钮只触发一次,过去几个小时我一直在努力解决这个问题但没有任何进展,有人可以指导我我在这里做错了什么吗

javascript - 将 ng-model 属性传递给自定义指令

所以,我有一个表单,我需要在其中使用自定义指令。我需要什么:将user模型传递给指令。指令模板如下所示:如何将user模型传递给指令模板?表单提交后,我需要user.testfield在$scope.user中可用,例如:console.log($scope.user){login:'test',password:'test',testfield:true|false} 最佳答案 你可以换个方式解决plunker简而言之:scope:{bindedModel:"=ngModel"},template:''

javascript - AngularJs - ng-options 在 ajax 调用后不绑定(bind)

我尝试在ajax调用后更改ng-options的选定索引,但它不会改变。//HtmlSection...//EndHtmlSection...//jsfile...//getlistofformulafromserver...TheSource.Get.then(function(response){$scope.the_formula=response.the_formula;});//dosomethingawesome,then..//bindingdatafromserver...TheData.Get.then(function(response){//bindingthed

javascript - AngularJS - 在 ng-click 中使用数据绑定(bind) {{}}

有没有办法动态改变ng-click调用的方法?像这样:ng-click="{{functionCalled}}"然后通过以下方式声明函数:$scope.functionCalled="callThisFunction(param)"; 最佳答案 来自docs,ngClick只是计算范围上下文中的表达式。没有什么可以阻止您动态引用函数,但我不确定这是预期的方法。我可能会显式调用函数并根据参数切换行为,而不是像ng-click='myFunction(myParams)'。尽管如此,这里有一个您要完成的示例。http://jsfiddl

javascript - 如何使用angularjs在单个ng-init指令中调用多功能

我只是尝试在angularjs的单个ng-init中调用两个函数。但它对我来说是错误的。我的代码:ng-init="function1();function2();"我不知道如何正确调用这些函数。任何人都可以给我一些想法。谢谢提前.. 最佳答案 您可以创建一个主函数,如“init”,然后在该函数内调用其他函数。ng-init="init()"从你的Controllerfunctioninit(){function1();function2();} 关于javascript-如何使用ang

javascript - 如何将 ng-model 输入值显示为 Angular 货币?

我在html中{{price|currency}}在Controller中$scope.price=10;Whichdisplays**$10**inh1ifichangethevalueinpricemodelinput.我希望文本框输入以货币形式输入(输入框中的10美元作为值)。如何实现? 最佳答案 您可以尝试使用formatters和parsers喜欢app.directive('currency',function(){return{require:'ngModel',link:function(elem,$scope,at

javascript - 使用来自 json 的 ng-flow.js 填充图像文件

我正在使用ng-flow在我的AngularJS应用程序中上传文件。我能够成功保存数据以及通过ng-flow上传多个文件。但是,在查询数据并通过JSON获取数据时,我不确定如何将文件添加到每一行的ng-flow对象中。每个文件都在JSON字符串中进行base64编码。澄清一下,我得到了每口井,每口井都有名称、位置、许可证等和多张图片。除图像外,井的所有属性都已成功填充到DOM中。HTML:...UploadFile{{$index+1}}{{file.name}}{{file.msg}}AngularJSController内部:wellsFactory.getData($scope.