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

相关问答

更多

ng-repeat呼叫控制器功能次数过多(ng-repeat call controller function too many times)

无论你在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(e...

在ng-repeat循环中显示来自不同文件夹的图像(Showing images from different folders inside ng-repeat loop)

每个$ http.get都写入相同的范围变量($ scope.images)。 我可能会将图像作为产品对象上的数组,以使它们彼此分离。 也许是这样的: $scope.getProducts = function() { $http.get('api/products'). success( function( data ) { $scope.products = data; for(var i = 0; i < $scope.products.len...

angularJS循环到ng-repeat(angularJS loop into ng-repeat)

您可以尝试添加自定义函数,以便根据需要“呈现”数据。 $scope.myvs = function(schedule) { if (schedule.NOM_EQU1 != null) { return schedule.NOM_EQU1 + " vs " + schedule.NOM_EQU2 } return "-" } 然后在您的视图中重用它,如下所示: <td>{{myvs(schedule)}}</td> 这个: schedule[$inde...

AngularJS - 在控制器中的ng-repeat undefined内部形成(AngularJS - form inside ng-repeat undefined in controller)

这是因为ng-repeat正在创建隔离的子作用域, form0位于子作用域中,而不是从父作用域(控制器的作用域)可见。 因此解决方案是将其传递给父级。 但是我们不能在ng-init中执行它,因为那时表单控制器没有初始化。 我能想到的一种方法是使用自定义指令将formController绑定到指定的范围。 app.directive("form",function($parse){ return{ restrict:"E", priority:-1, link:funct...

ng-if内部ng-repeat不从控制器更新(ng-if inside ng-repeat not updating from controller)

如果我理解正确,您的数据结构是这样的: formRows - >数组 row - >包含另一个对象列的对象 列 - >数组 我认为问题在于Angular正在跟踪对formRows的任何更改,当您的列对象发生更改时,这些更改不会发生,因为formRows中没有直接更改。 Angular并没有试图检查子子对象级别的变化,可以这么说。 您可以在每次更改行时创建新对象并将其添加回formRows。 或者,您可以添加deepwatch来检查列数组的更改。 检查一下: 如何深度观察angularjs中的数组?...

角度控制器加载但不显示ng-repeat(Angular controller loads but ng-repeat doesn't show)

如果你看一下带有类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 ...

如何从另一个控制器更新控制器的ng-repeat模型?(How to update the ng-repeat model of controller from another controller?)

您只需要一个服务,它保存您打算在不同控制器之间共享的数据。 演示 模板 <ul ng-controller='Ctrl1'> <li ng-repeat="item in items"> {{item}} </li> </ul> <div ng-controller="Ctrl2"> <input type="text" ng-model="newName"/> <button ng-click="addNew(newName)">Add</but...

ng-repeat中的angular Infinite $ digest循环(angular Infinite $digest Loop in ng-repeat)

不,你不能像这样在ngRepeat使用函数。 问题是Angular在摘要循环中使用严格的对象比较来确定自上次检查后属性的值是否发生了变化。 那么,每次调用getGroupedRange返回新值(新数组)。 Angular不知道并认为这个值不稳定,因此继续检查。 但它在10次检查后中止。 您需要构造必要的数组并将其分配给scope属性,因此在摘要循环期间不会更改: $scope.groupedRange = $scope.getGroupedRange(); 然后像在ngRepeat中一样使用它 ...

ng-repeat导致控制器中出现无限循环。(ng-repeat causing infinite loop in controller. Setting breakpoint show controller code executed infinitely)

我过去遇到的问题似乎与您的问题有关:如果您通过“templateUrl”包含访问模板的任何指令但由于某些原因,angular无法解析此指令的templateUrl,默认情况下它将返回模板对于index.html,它将再次包含你的指令,并且由于找不到指令的templateUrl,它再次默认为index.html 等等.... 这很可能是你的问题 A problem I had in the past that seems related to your issue: If you include w...

使用ng-repeat功能导致无限的摘要循环(Using function with ng-repeat causing infinite digest loop)

这里的解决方案是获取您需要的所有数据并创建一个类别数组,每个类别都包含自己的子类别。 并在嵌套的ng-repeats使用此对象。 请检查我的更新版本的plunker: https://plnkr.co/edit/BaHOcI4Qa8t5CkbshyCX 如你所见,我使用: ng-repeat="category in documents.categories" 在外部ng-repeat和: ng-repeat="service in category.subCategories" 在内在的。 ...

相关文章

更多

could not find system property or JNDI

Thanks everyone!! Finally got a solution for this p ...

mybatis There is no getter for property named 'xx' in 'class java.lang.String

用mybatis查询时,传入一个字符串传参数,且进行判断时,会报 There is no get ...

页面获取ACTION的属性,页面不能弹出JS

action定义一个属性,get set后 对属性赋值,值是JS,页面用&lt;s:property/ ...

Java:IO/NIO篇,读写属性文件(properties)

1. 描述 尝试用多种方法读取属性文件。 测试打印系统属性; 测试读取、写入用户属性文件; 测试 ...

oracle数据库中NOT IN 和 NOT EXISTS为什查不到数据

SELECT GA.ADID, GA.ADNAME FROM GAP_AD GA WHERE e ...

linux 文件系统详解之文件时间属性

目录 概述linux文件系统 概述linux文件的时间属性 详解各类时间属性 ...

css常用属性

CSS的基本语法 选择器 { 属性键:属性值; 属性键:属性值1 ...

solrcore.properties定义server是否是master

If the configuration directory for a Solr core cont ...

Linux 文件属性详解

Linux系统是一种典型的多用户系统,不同的用户处于不同的地位,拥有不同的权限。为了保护系统的安全性, ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本