Much to my surprise ng-include worked in place of ui-view.. I didn't think
using includes on nested views was possible but apparently it is
On Friday, June 6, 2014 7:36:01 PM UTC-5, St Paul wrote:
>
> I've spent a good part of 8 or so hours trying to figure this out. I've
> looked at SO many posts and tried a lot of things. I'm defeated, I need
> your help!
>
> So essentially I want to dynamically select which view to show based on
> session var. This seems like it would be easy but apparently I'm not
> Angularized enough yet to figure it out.
>
> Basically I have an abstract state "nav.tab4" set up as a layout container
> (which is a child of another abstract state named "nav"). In this state is
> the layout where I define an element for the view and I want a function in
> my controller to return the name of the view. So it looks like "<div
> ui-view="getView()"></div>". So when I call the child state
> "nav.tab4.report" the abstract state "nav.tab4" is invoked which includes
> the view container of which the name property should be populated by the
> function in my controller. When I go to the "nav.tab4.report" state it
> doesn't load any view at all.
>
> State routing code:
>
> $stateProvider
> .state("nav", {
> abstract: true,
> templateUrl: "src/shared/partials/navigation.html"
> controller: "navController"
> })
>
> .state("nav.tab4", {
> abstract: true,
> templateUrl: "src/scholarlyActivity/partials/main.html",
> controller: function($scope) {
> $scope.getView = function() {
> return "user"
> }
> }
> })
>
> .state("nav.tab4.report", {
> views: {
> "admin":{ templateUrl:
> "src/scholarlyActivity/partials/admin-report.html"},
> "user":{ templateUrl:
> "src/scholarlyActivity/partials/individual-report.html"}
> }
> })
>
>
> This seems like such an easy problem to fix but I haven't been able to get
> anything to work Any help is appreciated. Thanks
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.