它是可能做這樣的工作沒有一個適當的控制器,但我會勸阻它。這就是說,我繼續得到它反正工作:
<p class="text-justify last-body" ng-app>
This growing collection of studies, curated by
<a ng-init="imgsrc={
src: 'http://wallpaper-gallery.net/images/pig-images/pig-images-12.jpg',
show: false,
};">
<span ng-mouseover="imgsrc.show = true" ng-mouseout="imgsrc.show = false">
Yours Truly
</span>
<img ng-src="{{ imgsrc.src }}" ng-show="imgsrc.show" />
</a>,
is focused primarily
on studies dealing with eh tohp ah key pig*. As a fan of mooshoo and aigeiaig, I'm open to
working with any dataset ranging from yakdkat studies to lakuktauka. If you would like
to submit a study for publishing, or if you have any questions about a particular study,
please feel free to <a href="/contact">Contact Me.</a> Thank you for visiting, and happy wamotiem!
</p>
這將顯示圖像,當你將鼠標懸停在「此致」,並隱藏圖像,當你移動鼠標了。阻止你的例子工作的主要原因是缺少來自最頂層元素的ng-app
指令。除此之外,我還清理了一些邏輯,以便更容易理解發生了什麼。
這裏是一個JSFiddle,如果你想看到它的行動:https://jsfiddle.net/kv4qvu3w/2/