首页 \ 问答 \ NAnt属性:: exists()与新定义的属性?(NAnt property::exists() with newly defined property?)

NAnt属性:: exists()与新定义的属性?(NAnt property::exists() with newly defined property?)

在NAnt 0.92中,我定义了一个属性,并在检查后立即存在。 它不存在......但它存在于被调用的目标中。 这是一个错误还是一个功能?!? 我在文档中搜索但找不到它。

<target name="test">
  <property name="testprop" value="test value" />

  <echo message="property value = ${testprop}" />

  <if test="${property::exists(testprop)}">
     <echo message="property exists, as it should!" />
  </if>

  <if test="${not property::exists(testprop)}">
     <echo message="property doesn't exists... WTF?" />
  </if>

  <call target="test2" />
</target>

<target name="test2">
  <echo message="property value in sub-target = ${testprop}" />
</target>

输出:

测试:

 [echo] property value = test value
 [echo] property doesn't exists... WTF?

测试2:

 [echo] property value in sub-target = test value

In NAnt 0.92, I define a property and immediately after checks it's existence. It doesn't exists... but it exists in a called target. Is this a bug or a feature?!? I search in the documentation but could not find a mention of it.

<target name="test">
  <property name="testprop" value="test value" />

  <echo message="property value = ${testprop}" />

  <if test="${property::exists(testprop)}">
     <echo message="property exists, as it should!" />
  </if>

  <if test="${not property::exists(testprop)}">
     <echo message="property doesn't exists... WTF?" />
  </if>

  <call target="test2" />
</target>

<target name="test2">
  <echo message="property value in sub-target = ${testprop}" />
</target>

Output:

test:

 [echo] property value = test value
 [echo] property doesn't exists... WTF?

test2:

 [echo] property value in sub-target = test value

原文:https://stackoverflow.com/questions/15168112
更新时间:2023-03-28 16:03

最满意答案

我过去遇到的问题似乎与您的问题有关:如果您通过“templateUrl”包含访问模板的任何指令但由于某些原因,angular无法解析此指令的templateUrl,默认情况下它将返回模板对于index.html,它将再次包含你的指令,并且由于找不到指令的templateUrl,它再次默认为index.html

等等....

这很可能是你的问题


A problem I had in the past that seems related to your issue: If you include whatever directive that access a template through "templateUrl" but for some reasons, angular can't resolve the templateUrl of this directive, by default it will return the template for index.html which will contain again your directive and because the templateUrl for the directive is not found, it default again to index.html

and so on....

This is most likely your issue here

相关问答

更多
  • 无论你在html上绑定什么都是正确的,它会在每个由角度js运行的摘要周期中被调用。 使用{{::prepareAlertValue(event.AlertValue)}}绑定一次只执行该函数的指令。 注意绑定一次仅适用于Angular 1.3+以上 That is correct what ever you bind on html, it gets called on each digest cycle run by angular js. Use {{::prepareAlertValue(event. ...
  • 每个$ http.get都写入相同的范围变量($ scope.images)。 我可能会将图像作为产品对象上的数组,以使它们彼此分离。 也许是这样的: $scope.getProducts = function() { $http.get('api/products'). success( function( data ) { $scope.products = data; for(var i = 0; i < $scope.products.length; ...
  • 您可以尝试添加自定义函数,以便根据需要“呈现”数据。 $scope.myvs = function(schedule) { if (schedule.NOM_EQU1 != null) { return schedule.NOM_EQU1 + " vs " + schedule.NOM_EQU2 } return "-" } 然后在您的视图中重用它,如下所示: {{myvs(schedule)}} 这个: schedule[$index]是错误 ...
  • 这是因为ng-repeat正在创建隔离的子作用域, form0位于子作用域中,而不是从父作用域(控制器的作用域)可见。 因此解决方案是将其传递给父级。 但是我们不能在ng-init中执行它,因为那时表单控制器没有初始化。 我能想到的一种方法是使用自定义指令将formController绑定到指定的范围。 app.directive("form",function($parse){ return{ restrict:"E", priority:-1, link:function(s ...
  • 如果我理解正确,您的数据结构是这样的: formRows - >数组 row - >包含另一个对象列的对象 列 - >数组 我认为问题在于Angular正在跟踪对formRows的任何更改,当您的列对象发生更改时,这些更改不会发生,因为formRows中没有直接更改。 Angular并没有试图检查子子对象级别的变化,可以这么说。 您可以在每次更改行时创建新对象并将其添加回formRows。 或者,您可以添加deepwatch来检查列数组的更改。 检查一下: 如何深度观察angularjs中的数组? If I ...
  • 如果你看一下带有类row的前两个div,你会注意到,第一个div附加了一个ng-controller (并显示你的标题),而第二个div没有连接控制器(并且什么也没显示)。 由于ng-repeat不是控制器行的子元素,因此无法在那里使用控制器。 你可以解决这个问题,如果你将ng-controller向上移动一个元素,那么它将在你所有行的父元素上。 If you look at the first two divs with the class row, you will notice, that the f ...
  • 您只需要一个服务,它保存您打算在不同控制器之间共享的数据。 演示 模板
    • {{item}}
    ...
  • 不,你不能像这样在ngRepeat使用函数。 问题是Angular在摘要循环中使用严格的对象比较来确定自上次检查后属性的值是否发生了变化。 那么,每次调用getGroupedRange返回新值(新数组)。 Angular不知道并认为这个值不稳定,因此继续检查。 但它在10次检查后中止。 您需要构造必要的数组并将其分配给scope属性,因此在摘要循环期间不会更改: $scope.groupedRange = $scope.getGroupedRange(); 然后像在ngRepeat中一样使用它
  • 我过去遇到的问题似乎与您的问题有关:如果您通过“templateUrl”包含访问模板的任何指令但由于某些原因,angular无法解析此指令的templateUrl,默认情况下它将返回模板对于index.html,它将再次包含你的指令,并且由于找不到指令的templateUrl,它再次默认为index.html 等等.... 这很可能是你的问题 A problem I had in the past that seems related to your issue: If you include whatev ...
  • 这里的解决方案是获取您需要的所有数据并创建一个类别数组,每个类别都包含自己的子类别。 并在嵌套的ng-repeats使用此对象。 请检查我的更新版本的plunker: https://plnkr.co/edit/BaHOcI4Qa8t5CkbshyCX 如你所见,我使用: ng-repeat="category in documents.categories" 在外部ng-repeat和: ng-repeat="service in category.subCategories" 在内在的。 在Cont ...

相关文章

更多

最新问答

更多
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • Java中的不可变类(Immutable class in Java)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • EXCEL VBA 基础教程下载
  • RoR - 邮件中的动态主体(部分)(RoR - Dynamic body (part) in mailer)
  • 无法在Google Script中返回2D数组?(Can not return 2D Array in Google Script?)
  • JAVA环境变量的设置和对path , classpth ,java_home设置作用和目的?
  • mysql 关于分组查询、时间条件查询
  • 如何使用PowerShell匹配运算符(How to use the PowerShell match operator)
  • Effective C ++,第三版:重载const函数(Effective C++, Third edition: Overloading const function)
  • 如何用DELPHI动态建立MYSQL的数据库和表? 请示出源代码。谢谢!
  • 带有简单redis应用程序的Node.js抛出“未处理的错误”(Node.js with simple redis application throwing 'unhandled error')
  • 使用前端框架带来哪些好处,相对于使用jquery
  • Ruby将字符串($ 100.99)转换为float或BigDecimal(Ruby convert string ($100.99) to float or BigDecimal)
  • 高考完可以去做些什么?注意什么?
  • 如何声明放在main之后的类模板?(How do I declare a class template that is placed after the main?)
  • 如何使用XSLT基于兄弟姐妹对元素进行分组(How to group elements based on their siblings using XSLT)
  • 在wordpress中的所有页面的标志(Logo in all pages in wordpress)
  • R:使用rollapply对列组进行求和的问题(R: Problems using rollapply to sum groups of columns)
  • Allauth不会保存其他字段(Allauth will not save additional fields)
  • python中使用sys模块中sys.exit()好像不能退出?
  • 将Int拆分为3个字节并返回C语言(Splitting an Int to 3 bytes and back in C)
  • 在SD / MMC中启用DDR会导致问题吗?(Enabling DDR in SD/MMC causes problems? CMD 11 gives a response but the voltage switch wont complete)
  • sed没有按预期工作,从字符串中间删除特殊字符(sed not working as expected, removing special character from middle of string)
  • 如何将字符串转换为Elixir中的函数(how to convert a string to a function in Elixir)