.controller('HomeController', function($scope,$location) {
$scope.userName='天下大势,为我所控!';
$scope.clkUrl=function(){
$scope.pageUrl='norout1.html';//更改值
}
$scope.clk2=function(){
alert($scope.userName);
$scope.userName='司马懿'
}
}).directive('bhtml',function(){
    return {
templateUrl:'norout1.html',
restrict:'E',
replace:true

}
})
<div ng-controller="HomeController as homeP"> <p>下面是指令载入文件:<bhtml></bhtml></p> </div>  norout1.html: <p> <pre> 这里是:没有使用路由载入 <button ng-click="clk2()" >看是否能访问到数据</button> <input type="text" ng-model="userName"/> </pre> </p>
replace:true导致AngularJS: 'Template for directive must have exactly one root element' when using 'th' tag in directive template
删除或设置为false。

AngularJS: 'Template for directive must have exactly one root element' when using 'th' tag in directive template的更多相关文章

  1. Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value '"*, Microsoft.AspNet.Mvc.TagHelpers"'

    project.json 配置: { "version": "1.0.0-*", "compilationOptions": { " ...

  2. VS2015突然报错————Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value 'Microsoft.AspNet.Mvc.Razor.TagHelpers.UrlResolutionTagHelper

    Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with ...

  3. VUE之命令行报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead 解决办法

    Failed to compile. ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-5992 ...

  4. VUE编译报错 Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead

    背景: 在使用VUE添加标签的时候编译报错,报错如下: Component template should contain exactly one root element. If you are u ...

  5. vue报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.

    在.vue文件中引入了 element-ui 的 table 和 pagination 组件后,报错:Component template should contain exactly one roo ...

  6. 组件嵌套时报:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.

    在组件嵌套的过程中,报了一个错误: 这里报错的原因是:vue的组件(模板)只能有一个根节点,即.vue文件中的<template>标签下只能有一个子元素. 因此,建议大家在写.vue组件的 ...

  7. Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.

    运行代码时,一直报错: 经过查询后才知道,vue模板只能有一个跟对象 我是这样写的 最后修改为 就可以正常运行了

  8. vue父子组件嵌套的时候遇到 - Component template should contain exactly one root element. If you are using v-i

    转自:https://blog.csdn.net/yangyiboshigou/article/details/72084619

  9. 【错误总结】Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.

    大致意思是因为模板里面应该包含一个根元素,使用组件的时候应该用div或p标签包起来

随机推荐

  1. 【Unity3D基础】让物体动起来②--UGUI鼠标点击逐帧移动

    背景 上一篇通过鼠标移动的代码很简单,所以看的人也不多,但是还是要感谢“武装三藏”在博客园给出的评论和支持,希望他也能看到第二篇,其实可以很简单,而且是精灵自控制,关键是代码少是我喜欢的方式,也再次印 ...

  2. 学习OpenCV——BOW特征提取函数(特征点篇)

    没日没夜的改论文生活终于要告一段落了,比起改论文,学OpenCV就是一件幸福的事情.OpenCV的发展越来越完善了,已经可以直接使用BOW函数来进行对象分类了. 简单的通过特征点分类的方法:     ...

  3. 解决Ruby在IE11中报Unable to get browser (Selenium::WebDriver::Error::NoSuchWindowError)的错误

    转载地址:http://www.tuicool.com/articles/BRnqeu2 I was updating the browser WebDrivers for    Seleno    ...

  4. MSDeploy

    http://blogs.iis.net/jamescoo/default.aspx   Web Deployment Tool Now Works With Credential Store Feb ...

  5. 十九、Java基础--------IO流之字节流

    在上一篇文章中介绍了IO体系以及一些基本概念和字符流的相关应用,本文着重介绍字节流的相关操作. 字节流 它的操作与字符流类似,可以参与字符流的定义.读取.写入.处理异常的格式,只不过是处理的数据不同, ...

  6. 【svn】一个设置,少写几个字

    以下场景仅适用于修改bug的时候,在提交代码的时候少写几个字,嘿嘿: 1.打开[SVN 属性],在代码目录右键 2.打开BUG跟踪设置窗口 3.输入BUG的URL前缀以及%BUGID%,如 复选框,建 ...

  7. ubuntu 如何 su 到 root(作为 root 用户操作)

    ubuntu 安装后,root用户默认被锁定,不允许登录,也不允许"su"到 root.对于桌面用户来说,这样安全性更高一些,但对于服务器可以设置成"允许 su 到roo ...

  8. 删除已经配置的类库和移除CocoaPods[转]

    转自:http://blog.csdn.net/jymn_chen/article/details/19213601 引言 在使用CocoaPods(一)为项目配置第三方类库我们使用CocoaPods ...

  9. linux下tftp使用(转一些命令)

    转载于:http://cache.baiducontent.com/c?m=9d78d513d99d1af31fa7837e7c5083205b4380122ba6d1020ba5843990732c ...

  10. Maven 使用介绍

    1,创建Project 先去官方网站下载一个最新版本http://maven.apache.org/download.cgi. 下载后解压,使用之前最好先将maven的bin目录设置到path环境变量 ...