Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Meteor中生成if语句_Meteor_Reactive Programming_Ace Editor - Fatal编程技术网

在Meteor中生成if语句

在Meteor中生成if语句,meteor,reactive-programming,ace-editor,Meteor,Reactive Programming,Ace Editor,我是新来的流星。我开始使用会话使内容在不同的模板之间反应。我还在我的应用程序中使用Ace文本编辑器。它有一些配置设置: Template.template_containing_AceTextEditor.configuration = function(){ return function(editor){ if (Session.get('text') == "something") //here I want it to be react

我是新来的流星。我开始使用会话使内容在不同的模板之间反应。我还在我的应用程序中使用Ace文本编辑器。它有一些配置设置:

Template.template_containing_AceTextEditor.configuration = function(){
      return function(editor){
                    if (Session.get('text') == "something") //here I want it to be reactive
                    {          
                       //do something every time 'text' changes
                    }
      }

}

我也不想丢失包含AceTextEditor.configuration的Template.Template,因为它连接到我正在使用的包。

好吧,你可以通过几种方式使代码反应,一种是将反应代码放入
Tracker.autorun

Tracker.autorun(function(){
  if (Session.get('text') == "something") //this will run every time session text changes
     {          
       //do something every time 'text' changes
     }
})

确保将跟踪程序加载到项目中。

您是否尝试过使用帮助程序?一旦您定义了助手(它是被动的),您就可以在带有{{#if something}的把手中使用它