我有两个指令,我想在其中一个中公开一个API,供其他人使用。在的指导下,当我需要另一个指令的控制器时,我得到了这个错误:
Error: No controller: foo
at Error (<anonymous>)
at getControllers (http://localhost:3000/vendor/angular/angular.js:4216:19)
at nodeLinkFn (http://localhost:3000/vendor/angular/angular.js:4345:35)
at compositeLinkFn (
当我使用angular的指令时,我得到了这个错误。
Error: [$compile:tplrt] Template for directive 'header' must have exactly one root element. /apps/dhe.techForm/views/directives/header.html
http://errors.angularjs.org/1.4.8/$compile/tplrt?p0=header&p1=%2Fapps%2Fdhe.techForm%2Fviews%2Fdirectives%2Fheader.h
我是AngularJS的新手。我已经了解到,我可以使用如下查询在DOM中查找元素:
var e = angular.element(document.querySelector('#id'));
var e = angular.element(elem.querySelector('.classname'));
这对于通过ID或CSS类名查找元素很有用。但是,我需要能够使用不同的方法找到一个元素。我有一个看起来像下面这样的元素:
<div my-directive class='myContainer'>...</div>