草庐IT

angularjs-components

全部标签

javascript - AngularJS:如何停止 ng-click 的事件传播?

我有这样的指令:app.directive('custom',function(){return{restrict:'A',link:function(scope,element){element.bind('click',function(){alert('wanttopreventthis');});}}});是的,对于这种情况,有必要进行jQuery方式的绑定(bind)。现在我想在满足某些条件时停止此事件(点击)传播。尝试过:$event.stopPropagation();$event.preventDefault();但这并没有帮助。例如这里的fiddle-http://j

javascript - 使用 AngularJS 进行 Visual Studio Code 调试

我想用新的VisualStudioCode调试我的Angular应用程序,但Angular和VisualStudioCode似乎有问题..这是我的launch.json:{"version":"0.1.0",//Listofconfigurations.Addnewconfigurationsoreditexistingones.//ONLY"node"and"mono"aresupported,change"type"toswitch."configurations":[{//Nameofconfiguration;appearsinthelaunchconfigurationdro

javascript - 从 AngularJS 访问全局变量

我想用嵌入在HTML页面中的JSON对象初始化Angular模型。示例:vartags=[{"name":"somejson"}];{{tag.name}}tags字段无法解析,因为它是在$scope中查找的。我试图像这样访问Controller中的tags字段:functionTagList($scope,$rootScope){$scope.tags=$rootScope.tags;}但它不起作用。只有当我将TagList直接包含到HTML页面并将JSON直接呈现到此函数中时,它才会起作用。如何在AngularController的单独js文件中访问tags字段?

javascript - 多个 Angularjs 应用程序(驱动 Portlet)

我有一个用例需要加载单独的Angular应用程序。基于几个堆栈溢出问题和thisgooglethread,这是可行的。但是,我无法让它工作。查看文档:http://docs.angularjs.org/api/angular.bootstrap看起来您需要提供元素(获取元素句柄的正确方法是什么?),然后如何将其绑定(bind)回配置、Controller等。这如何与路由一起使用?IE碰撞是如何工作的,即应用程序a和应用程序b分别将/foo映射到/fooa.html和/foob.html...或者每个应用程序描述自己的。否则?谢谢! 最佳答案

javascript - 停止 AngularJS promise 链

我正在尝试找出一个好方法来表达“做所有这些事情,但在其中任何一个失败的情况下保释”我现在拥有的:vardefer=$q.defer();this.load(thingy)//returnsapromise.then(this.doSomethingA.bind(this)).then(this.doSomethingB.bind(this)).then(this.doSomethingC.bind(this)).then(this.doSomethingD.bind(this)).then(function(){defer.resolve(this);});;returndefer.p

javascript - AngularJS 和 Jersey REST DELETE 操作失败,状态代码为 415

我有一个带有Jersey后端应用程序的AngularJS网络应用程序。现在一切正常,使用ngResource从AngularJS访问REST资源。唯一的问题是DELETE选项。我有以下代码使用我的ngResource删除类(class):Course.deleteCourse=function(course){course.$remove({courseId:course.id});returncourse;};在后端(Jersey)我有以下代码:@DELETE@Path("{id}")publicfinalvoidremove(@PathParam("id")finalStringi

javascript - react .js : Is it possible to namespace child components while still using JSX to refer to them?

假设我有一个名为ImageGrid的组件定义如下:window.ImageGrid=React.createClass({render:function(){return();}});如您所见,它包含一个名为ImageGridItem的子React组件。.其定义如下。window.ImageGridItem=React.createClass({render:function(){return(something);}});只要两者都是window的直接属性,这就可以正常工作.但这有点可怕,所以我想将我所有的react组件分组到window.myComponents的命名空间下。例如。

javascript - Ionic、angularjs、bootstrap 3 的左侧多级菜单无法正常工作

我需要这个这是Controller代码:$scope.sideNavMenu={title:"UserManual",subMenu:[{title:"Titleone",link:"index/titleone.html",icon:"fafa-caret-down",subMenu:[]},{title:"Basic",link:"index/basic/basic.html",icon:"fafa-caret-down",subMenu:[{title:"BasicFunction",link:"index/basic/function.html",icon:"fafa-care

javascript - 类型错误 : module is not a function AngularJS & Jasmine

在我的示例应用程序中,我像这样测试运行器收藏夹Controller:varmodule=angular.module('AngularSampleApp',[]);varFavoritesController=module.controller('FavoritesController',functionfavoritesController($scope){$scope.phones=[{'name':'NexusS','snippet':'FastjustgotfasterwithNexusS.'},{'name':'MotorolaXOOM™withWi-Fi','snippet

javascript - Angular 2 : Validate child component form fields from the parent component

问题陈述:父组件有标签和一些里面的标签,子组件也有一些标签,父组件有一个我们正在验证提交表单时的表单字段。如何验证子组件来自父组件的字段submit表格?要求:如果父组件的表单包含带有input的子组件模板中的组件,然后是这些input如果从父组件提交,组件应该在点击时验证。调查结果:SO中有很多帖子有相同的问题陈述,但没有找到任何合适的解决方案。以下所有帖子都验证了整个表单,但我的要求是验证子组件中的每个字段。Angular2validationtogetherwiththechildcomponentAllowtemplate-drivenforminputsacrossacomp