I have the following HTML:
Both of your directives are trying to replace the element in the dom. Try removing the the replace: true
lines in your directive definition object.
In my case, I had a reference to a missing file in the BundleConfig, I removed the reference and it started to work.
For me, this was caused by multiple copies of the directive and template existing in the dist directory caused by grunt building without cleaning (during a watch task). A clean and rebuild solved this for me.
You can’t have one (element) directive directly referencing another (element) directive. Wrap it with a <div>
, e.g:
template: '<div><my-custom-directive>'
+ '</my-custom-directive></div>'
See https://github.com/angular/angular.js/issues/5428 for more information.
For Visual Studio users using TypeScript, this got me. I'd renamed my typescript file and the built .js file was in the directory (but it doesn't show up in the project). I had to show all files in the directory to remove the lingering unused *.js files.
(in case it helps someone else)
For me the issue was having a backup file (i.e. .bkp.html) which was just an old copy of a template I was using for reference - but this was being included by karma since it matched the ".../**/*.html" pattern.