草庐IT

angular2-meteor

全部标签

javascript - 在 Meteor 中使模板助手具有反应性

我正在构建一个聊天应用程序,在我的“新聊天”页面上我有一个联系人列表,您可以通过点击它们来一个接一个地选择(在此基础上我应用了一个CSS选择类并将用户ID推送到一个名为“newChatters”的数组。我想让这个数组对辅助方法可用,这样我就可以显示一个响应式名称列表,其中包含已添加到聊天中的所有用户。我想在其中显示react列表的模板:{{newChatters}}选择联系人时触发的clickcontactItem事件:Template.contactsLayout.events({'click#contactItem':function(e){e.preventDefault();$

javascript - 将公历日期转换为 Angular 2 和 Ionic 2 中的波斯语(jalali)日期

我熟悉位于npm中的一个包,用于将公历日期转换为波斯语(jalali),但我不知道我应该如何在ionic2angular2项目中使用它。Jalali-date或Angular1的这个包:ADM-dateTimePicker是否可以将此包转换为angular2?任何的想法?欢迎或教程... 最佳答案 好的,我为此编写了转换器,首先在你的项目中添加一个provider:import{Injectable}from'@angular/core';@Injectable()exportclassPersianCalendarService{

javascript - "CUSTOM_ELEMENTS_SCHEMA"Angular 2 App 测试错误

在为我的Angular2应用程序编写测试时,我遇到了这些错误:我们正在使用的选择器:"):AppComponent@12:35'tab-view'isnotaknownelement:1.If'my-tab'isanAngularcomponent,thenverifythatitispartofthismodule.2.If'my-tab'isaWebComponentthenadd"CUSTOM_ELEMENTS_SCHEMA"tothe'@NgModule.schemas'ofthiscomponenttosuppressthismessage.("[ERROR->]我已经添加了

javascript - 如何使用 $route 和 $routeParams 更新 angular js 中的 url?

如何重定向或更新网址?我找不到任何关于此的好文档。基本上,我想做的是动态更改$routeParams并使用新值更新url。我的代码是这样的:if($routeParams.time){varurl;$routeParams.time=encodeURIComponent(value);url='/'+$routeParams.time+'/'+'marketing/networks';$location.path(url);}else{$routeParams.time=encodeURIComponent(value);url='/'+$routeParams.time+$locat

javascript - 我如何模拟缓慢的 Meteor 发布?

我试图模拟一个发布做一堆工作并花很长时间返回一个游标。我的发布方法有强制休眠(使用future),但应用程序始终只显示正在加载...这是出版物:Meteor.publish('people',function(){Future=Npm.require('fibers/future');varfuture=newFuture();//simulatelongpausesetTimeout(function(){//UPDATE:codingerrorhere.Thislineneedstobe//future.return(People.find());//Seetheaccepteda

javascript - Angular module.run ReferenceError : $location is not defined

我想在不重新加载的情况下改变AngularJS的路径,看http://joelsaupe.com/programming/angularjs-change-path-without-reloading/在core.js中:'usestrict';angular.module('App',['ngRoute']).run(['$route','$rootScope','$location',function($route,$rootScope,$location){varoriginal=$location.path;$location.path=function(path,reload

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 - Angular JS 中的 `$.each()` 替代方案

AngularJS中jquery的$.each()循环的替代方案是什么。我在jquery中得到了以下内容(在我基于AngularJS的项目中):$($scope.tasks).each(function(index,task){if(task.isCompleted){task.showTask=true;}});而且我不想混合使用jquery和angular,因为他们说这样做是不好的做法(是吗?)。Angular有没有像$.each()这样的功能?还是我应该使用普通的javascript? 最佳答案 您可以使用angular.fo

javascript - 如何在 Angular 2 组件中单击时更改 bool 值

如何连接按钮以更改其下方指令中[codeOnly]值的值?我在typescript中使用Angular2.4.10。Clickmetochangeallofthe[codeOnly]valuesbelowtotrue 最佳答案 在包含您的HTML的组件中添加isFoo:boolean=false;然后将HTML更改为Clickmetochangeallofthe[codeOnly]valuesbelowtotrue或切换Clickmetochangeallofthe[codeOnly]valuesbelowtotrue

javascript - Angular 4 - 条件 CSS 类

我正在开发Angular4应用程序,我们在其中向用户提供登录信息。登录可能会失败,返回时,我们会监听错误:-.subscribe(error=>{this.error=error;});这显示很好,我们显示这个:-{{error.ExceptionMessage}}上面是一个带有类的用户名和密码的标准输入字段。我希望能够在不执行以下操作的情况下向其中添加一个error类:-有没有比在if的每一侧渲染输入两次更好的方法?谢谢! 最佳答案 您可以使用类绑定(bind)来做到这一点: 关于ja