Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How Can I add a editable text box on canvas when we click on button using "angular5" only

What I have tried:

I have created a button using bootstrap and i want code onclick Add button a editable text box to be loaded in our id defined position
onclick fn should be in 'Using Angular5 ' only

<title>
Bootstrap Page
CSS
.row {
		position: relative;
		}
		
	body {
			background-size: cover;
			min-width: 100%;
		}
		
	.left {
		border: 2px dashed black;
		height: 100vh;
		width: 100%;
		}

	#myCanvas {
		background:url("https://s10.aconvert.com/convert/p3r68-cdx67/bpvcr-e5c8y.svg");
		background-repeat: no-repeat;
		background-size: inherit;
		background-size: 900px 368px;
	}
	.right {
		border: 1px dotted red;
		height: 100vh;
		width: 100%;
		position: relative;
		}

	.add_text {
	    position: absolute;
		right: 10px;
		top: 10px;
		padding-left: 30px;
		padding-right: 30px;
		
		}
	.page-header {
		background-color:#31ac31;
		min-height: 80;
		max-height: 100;
		}

	img {
		height: 50;
		}
		
	.square {
			height: 75px;
			width: 75px;
		}


HTML
<br>


	<div>


	<br>
	 
		 <h>CM Edits
	

	<div class="row"> 
			<div class="col-md-1 col-sm-1 col-lg-1"> </div>
			
			 <div class="col-md-7 col-sm-7 col-lg-7">
			 
			 </div>
			  <div class="col-md-1 col-sm-1 col-lg-1"> </div>
			 
			<div class="col-md-3 col-sm-3 col-lg-3">
				Add Text
			</div>
	
	</div>
			
	<br><br><br>
		<div class="row"> 
			<div class="col-md-1 col-sm-1 col-lg-1"> </div>
				   <div class="col-md-7 col-sm-7 col-lg-7 left">
							   <canvas id="myCanvas" width="829" height="500" style="padding-left: inherit">
									 
									
							   
				   </div>
				   
					 <div class="col-md-1 col-sm-1 col-lg-1"> </div>
					 
				   <div class="col-md-3 col-sm-3 col-lg-3 right">
						  right pannel 
						

					

						 
				   </div>
		 </div>
	 </div>
Posted
Updated 12-May-19 1:35am
v3

1 solution

By standard canvas should not have input elements with type="text" (even you may find browsers supporting it)...
You a may create a div element that will overflow the canvas and actually hold the input... but it is probably better to rethink your design...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language | MDN[^]
 
Share this answer
 
Comments
AmalkiranCM 13-May-19 2:04am    
Can u explain by simple code I want svg on canvas to be loaded with angular5
Kornfeld Eliyahu Peter 13-May-19 2:14am    
If you use SVG, you probably do not need canvas... Think about it...
https://teropa.info/blog/2016/12/12/graphics-in-angular-2.html
AmalkiranCM 13-May-19 13:40pm    
But my task is to design this in angular5 ..See same like this :
https://www.deluxe.com/products/design-x/your-design-business-card-2-x-3-12-rectangle-horizontal/43562/?optid=88

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900