简体   繁体   中英

AngularJS ng-view, ng-click and routerProvider not working together

I've been scratching my head for some time over this puzzle. I've been trying to load an external file into an ng-view (no problems here). And in that partial file I have text that get swapped for an input field when you click "Edit title", but this only works when all code is included in the same file.

If you take a look at this Plunker http://plnkr.co/edit/cgUGOKVzWKNWugqrFCbJ you'll see what I mean.

I would appreciate if you could point me in a direction that could solve this issue for me.

Thanks!

The "#" in the hrefs are probably making angular render the html and the controller again.

Change them as below and it should work:

<a href="javascript:void(0)" ng-click="enableEditor()">Edit title</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM