Last post Dec 28, 2017 05:54 PM by bruce (sqlwork.com)
Dec 28, 2017 12:10 AM|HiThereItsClaire|LINK
I have inherited an angular.js project and I am trying to understand the flow of the code and what happens. I am analyzing this piece of code (I removed some of the lines, but the base elements remain).
Do I understand properly that when the pop-up is displayed this code will accept the user input, then when the user presses the Complete button the DCila method will run?
'<md-dialog aria-label="">' +
'<md-dialog-content ng-cloak>' +
'<div class="md-dialog-content">' +
'<form ng-submit="$event.preventDefault()">' +
'<md-autocomplete ' +
'<md-button aria-label="Complete" ng-click="ctrl.finish($event)">Complete</md-button>' +
Dec 28, 2017 08:01 AM|Eric Du|LINK
According to your description, i checked your code, the logical of the code will show the dialog, you could input the text in it, but about how to trigger the click event, we usually use the following method: ng-click="functionname()". I hope you could run
it in your side, check if meet the issue.
For more details, please check the following tutorial:
$mdDialog API Documentation:
Dec 28, 2017 05:54 PM|bruce (sqlwork.com)|LINK
you should read the angular documentation. angular uses the MVC pattern, with routers, controllers, and views. the view engine is a template engine.
your sample code is using the new controllerAs syntax, that changes how scope is handled. but you are correct DCila is the controller that will be called. You should read up n the new controllerAs syntax to better understand the binding.
note: I'm not an angular developer (prefer react/redux instead), so only know enough angular to be dangerous.