javascript - Ng-src updates but src does not when deleting photo -


इस प्रश्न का संदर्भ:

मैं समाधान का उपयोग कर रहा हूँ यह प्रश्न: तो मेरे विचार में मेरे पास है:

  & lt; img ng-src = "{{user.photo.pathRelative}} {{randomStr}}" alt = "" / & gt;   

जब मैं फोटो बदलता हूं, तो मैं अपने contoller में निम्न कोड चलाता हूं:

  $ scope.user.photo.pathRelative = somePathToPhoto; $ scope.randomStr = '? randomStr =' + नया दिनांक ()। getTime ();   

यह निम्न HTML (और हर काम करता है, जैसा कि यह होना चाहिए) में परिणाम:

  & lt; img ng-src = "img / प्रोफाइल / 5350f142dd9624b818d90007 / 5350f142dd9624b818d90007.png? RandomStr = 1398159116845 "alt =" "src =" आईएमजी / प्रोफाइल / 5350f142dd9624b818d90007 / 5350f142dd9624b818990007.png? RandomStr = 1398159116845 "& gt;   

प्रश्न:

अब मैं उपयोगकर्ता को इस तस्वीर को हटाने की अनुमति देना चाहता हूं, इसलिए जब वह मेरे द्वारा हटाए गए बटन को मारता है:

  $ scope.user.photo.pathRelative = ''; $ Scope.randomStr = '';   

हालांकि, यह निम्न html में परिणाम है:

  & lt; img ng-src = "" alt = "" src = "? randomStr = 1398159116845 "& gt;   

इसलिए src विशेषता अभी भी सेट है, इसलिए ब्रवर इसे रेंडर करने की कोशिश करता है लेकिन जाहिर है कि पथ मान्य नहीं है।

कोई भी संकेत क्यों यह गलत मान पर सेट है ?

आप img तत्व से छुटकारा पाने के लिए सेट अप कर सकते हैं पथ सेट नहीं है।

Comments

Popular posts from this blog

c# - The item with identity 'Id' already exists in the metadata collection. Parameter name: item -

sql - PostgreSQL automatically update row at specific date -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -