[英]how to add ng-click in angular 1.4.5 using transformation?
I am using xslt + angular js
.I am making list of items .I am able to make it but now I want to add click event using angular js
can I add ng-click
here .I am using xslt 1.0 with angular js 1.4 here is my code 我正在使用
xslt + angular js
。我正在列出项目。我能够做到,但是现在我想使用angular js
添加click事件,可以在这里添加ng-click
。我在这里使用xslt 1.0和angular js 1.4是我的代码
http://xsltransform.net/jxDigUu/1 http://xsltransform.net/jxDigUu/1
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="html" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
<xsl:template match="list">
<hmtl>
<head>
<title>New Version!</title>
</head>
<body>
<ul>
<xsl:apply-templates select="name"/>
</ul>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js"/>
</body>
</hmtl>
</xsl:template>
<xsl:template match="name">
<li>
<xsl:value-of select="."/>
</li>
</xsl:template>
</xsl:transform>
data.xml data.xml中
<list>
<name>A new XSLT engine is added: Saxon 9.5 EE, with a namecense (thank you Michael Kay!)</name>
<name>XSLT 3.0 support when using the new Saxon 9.5 EE engine!</name>
<name>Preview your result as HTML when doctype is set to HTML (see this example)</name>
<name>Preview your result as PDF when doctype is set to XML and your document starts with root element of XSL-FO. Apache FOP is used to generate the PDF</name>
<name>Added some namenks to useful XSLT sites</name>
</list>
To check HTML 检查HTML
click on HTML
link on result window of above link 在以上链接的结果窗口中单击
HTML
链接
update code 更新代码
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="list">
<hmtl>
<head>
<title>New Version!</title>
</head>
<body ng-app="app">
<div ng-controller="appcontr">
<ul>
<xsl:apply-templates select="name"/>
</ul>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js"/>
<script>
angular.module('app',[]).controller('appcontr',appcontr)
function appcontr($scope){
$scope.name ='dd'
}
</script>
</body>
</hmtl>
</xsl:template>
<xsl:template match="name">
<li>
<xsl:value-of select="."/>
</li>
</xsl:template>
</xsl:stylesheet>
I added controller but getting error on console . 我添加了控制器,但在控制台上出现错误。 error is this
错误是这个
r**] Failed to instantiate module app due to: Error: [$injector:nomod] Module 'app' is not available! r **]由于以下原因而无法实例化模块应用程序:错误:[$ injector:nomod]模块“应用程序”不可用! You either misspelled the module name or forgot to load it.
您可能拼错了模块名称,或者忘记了加载它。 If registering a module ensure that you specify the dependencies as the second argument**.
如果注册模块,请确保将依赖项指定为第二个参数**。
将ng-app放入<html ng-app="app">
并将<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js"/>
在<head>
之前
The first script needs a closing tag: 第一个脚本需要一个结束标记:
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js">
<!-- ADD closing tag here -->
</script>
<script>
angular.module('app',[]).controller('appcontr',appcontr)
function appcontr($scope){
$scope.name ='dd'
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.