Angularjs - Loading a form from a template without using ng-view - angularjs

I have a crud application, The situation I want is when you click in the list, the edit form will be opened up in a modal dialog or toggling from the side.
the form is a template (/templates/form.html).
If I use ng-view, everything is simple, I set the templateUrl in the router and I get the form recompiled in the view.
But since I want to still see the grid, I want to open the form above it. so ng-view is not going to work.
how can I do the following from the controller:
load the template form maybe via ngInclude remember Im in the JS controller.
Bind the model
append the form with the binded model to the html
Thanks

Have you tried https://docs.angularjs.org/api/ng/directive/ngInclude ?
Hope it suits your case =)

Related

nested routing in angularJs help required

I want to have nested routing in angular-
In User.html, i will have three sections add, edit ,delete.
On click of add it should route to user/add and redirected to add.html and same for others.
How can this be achieved?
You can use $anchorScroll but that will not change your url mean you will stay on the same page and it will just scroll you to the section. As i can understand you want to have different actions on the same page, there are many ways to do so like angular like ng-show and ng-hide. You you the user edit view on demand and so with the add user. You can use same form for add new and edit. there is a tutorial on Angular page if you scroll down there is a section Wire up a Backend and that's something you want in your application i guess :-)

Can we rediect from Django view to some Angular View

I have been trying to google it out for quiet sometime but no luck. Can I redirect from Django view to angular view?
I mean normally when we return some some template file (like homepage.html), django looks into template or whatever dir we define and then opens up that html file. For Angular JS , we keep the homepage.html same and add ng-view in it, so that the html file stays the same ,only view inside it changes. The browser URL changes from
Before clicking on Angular View:
127.0.0.1/homepage
After clicking on some button which changes angular view:
127.0.0.1/homepage/#checkout
I have posted below question but no answer or solution has been posted :
How to redirect from Django views to a specific view of angular JS

Directives not working on dynamically loaded content

I have a weird situation. I created 2 directives in my application.
orgNavigation
menuEnhancer
orgNavigation is responsible to build the html structure and menuEnhancer is to apply DOM specific logic. Both working great with static data but when the dynamic data is introduced, menuEnhancer is not working.
To test the behavior of menuEnhancer, click on any menu item. It should bring popup, which is working fine in static loaded template. But for dynamic loaded template, popup is not working.
I am thinking it might be because menuEnhancer link is executing before the navigation items loaded. Can anyone help how to fix it?
Plnkr

Floating Box in AngularJS

I'm sorry if my topic doesn't suit my question. I'm new to Angular and I'm practicing by building an app. I want to achieve this kind of effect:
I have a button and when the button is clicked, I want to have a floating box like this. What is the best way to do this in Angular? If I would do it, I put the HTML of the box in my view and call a controller method every time the button is clicked to toggle the display of the block (using ng-show). Is that a good method? What method would you recommend? Thanks!
Use the angular ui bootstrap popover directive.
Here is a link: http://angular-ui.github.io/bootstrap/
You will have to edit the template to inject custom html though.
Hope this helps.

In mvc pattern how to show another view

Hi im developing an winform application using mvc pattern,
If i have a windows form as a view with a button in it, and i want to show another view(winform) on click of button in the first form.
In this case whether the view should should notify the button click to the controller and the contoller will instantiate the second form and show or the first view itself will do this.
The controller should probably handle it. In the purest form of the MVC pattern, views should be for displaying their own content, and any other logic, including displaying other views, is up to the controller. (In fact, for many actions, that is all the controller ends up doing.)

Resources