How to remove the push createdElement

actions: {
	addToList: function() {
		var task = this.get('controller').get('task');
		var todoList = document.getElementById('todoList');

		console.log(task); 
		var local = [];
		local.push(task);
		todoList.innerHTML += "<li>" + local + "<button class='delete' {{action 'remove'}}>X</button></li><br>";
	},
	remove: function(event) {
		var e = e || event;
		console.log('removed');
		if(e.targetName !== "BUTTON") {
			return false;
		}
		target.parentNode.parentNode.removeChild(target.parentNode);
	}

I want to remove the pushed listitem, the codes above works in vanilla JavaScript. But how could I apply that remove function properly to EmberJS.

check here

1 Like