backbone.js - Image not appear using cordova plugin -


i'm using 2 types of cordova plugin store image gallery , make retrieve back.

my project based on backbone.js. problem is, got weird problem last week. image still can't appear on next page after click button. got 2 pages, first page store image gallery after capture picture using camera cordova plugin. below code

page 1

javascript

function onphotourisuccess(imageuri) {     var largeimage = document.getelementbyid('image');     largeimage.style.display = 'block';     largeimage.src = imageuri;     localstorage.imageurl = imageuri; } 

html

<button onclick="getphoto(picturesource.photolibrary);">from photo library</button> <img id="image" name="image" src="" style= "display:none;width:100%;" /> 

then want retrieve image in gallery using imageuri store localstorage.imageurl. testing using hard corded imageuri, retrieve using console.log.

file:///var/mobile/applications/0cd4797d-0852-4c3a-bc25-c35642799e9e/tmp/cdv_photo_048.jpg 

page 2

html

<img id="image" name="image" src="file:///var/mobile/applications/0cd4797d-0852-4c3a-bc25-c35642799e9e/tmp/cdv_photo_048.jpg" style="display:none;width:100%;" /> 

it didn't working.

so, try inject imageuri view page (page 2) in programmatic way. create model , collection imageuri can render second page.

model

define(['underscore', 'backbone'], function(_, backbone) {     var linkmodel = backbone.model.extend({         defaults:{             imageurl: localstorage.imageurl         }         });     return linkmodel; }); 

collection

define(['underscore', 'backbone', 'model/link/linkmodel'], function(_, backbone, linkmodel) {     var linkcollection = backbone.collection.extend({         model: linkmodel     });     return linkcollection; }); 

view

define(['jquery', 'underscore', 'backbone', 'model/link/linkcollection', 'text!modules/link/linkconfirmviewtemplate.html'], function($, _, backbone, linkcollection, linkconfirmviewtemplate) {     var linkconfirmview = backbone.view.extend({         render: function() {             var variables = {                 imageurl: localstorage.imageurl             };             var compiledtemplate = _.template(linkconfirmviewtemplate, variables);             this.$el.html(compiledtemplate);         }     });     return linkconfirmview; }); <img id="image" name="image" src="<%= imageurl %>" style="display:none;width:100%;" /> 

i follow site still not working.

i doing research issue in stakeoverflow, still same.

yes, remove display:none on html.

<img id="image" name="image" src="" style= "display:none;width:100%;" /> 

to

<img id="image" name="image" src="" style="width:100%;" /> 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -