Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "julian"

Hi!

I'm having difficulties with the get-method in AngularJs. I have followed the step-by-step guide, but when I apply the instructions on my own project the results does'nt show and I have no idea what is wrong.

So I'm going all in with showing my stuff here:

My Application structure: i. Application ii. Sessions iii. GetBetTypesAppService iiii. BetTypesAppService.cs iiii. IBetTypeAppService.cs iiii. Dto iiiii. GetBetTypeListDto.cs iiiii. GetBetTypesInput.cs iiiii. GetBetTypesOutput.cs

So in my latest try to get it to work I placed all the classes and interfaces that is needed in an own map. FYI, I haven't changed a thing in any other file in Application so that's why I'm not showing any of them below.

BetTypesAppService.cs:

namespace Expertspel.Sessions
{
    [AbpAuthorize]
    class SessionAppService : ExpertspelAppServiceBase, ISessionAppService
    {
        [DisableAuditing]
        public async Task<GetCurrentLoginInformationsOutput> GetCurrentLoginInformations()
        {
            var output = new GetCurrentLoginInformationsOutput
            {
                User = (await GetCurrentUserAsync()).MapTo<UserLoginInfoDto>()
            };

            if (AbpSession.TenantId.HasValue)
            {
                output.Tenant = (await GetCurrentTenantAsync()).MapTo<TenantLoginInfoDto>();
            }

            return output;
        }

    }
}

IBetTypeAppService.cs:

namespace Expertspel.Sessions
{
    public interface ISessionAppService : IApplicationService
    {
        Task<GetCurrentLoginInformationsOutput> GetCurrentLoginInformations();
    }
}

BetTypeListDto.cs:

namespace Expertspel.Sessions.GetBetTypesAppService.Dto
{
    [AutoMapFrom(typeof(BetType))]
    public class BetTypeListDto : FullAuditedEntityDto
    {
        public string BetTypeCode { get; set; }

        public string BetTypeName { get; set; }
    }
}

GetBetTypesInput.cs:

namespace Expertspel.Sessions.GetBetTypesAppService.Dto
{
	public class GetBetTypesInput : IInputDto
	{
        public string Filter { get; set; }
	}
    
}

GetBetTypesOutput.cs is empty, the step by step guide did'nt involve it so neither did I.

Index.cshtml:

<div ng-controller="tenant.views.bet.index as vm">
    <div class="row margin-bottom-5">
        <div class="col-xs-6">
            <div class="page-head">
                <div class="page-title">
                    <h1>
                        <span>@L("Bet")</span>
                    </h1>
                </div>
            </div>
        </div>
        <div class="col-xs-6 text-right">
            <button class="btn btn-primary blue" @*ng-click="vm.doIt1()"*@><i class="fa fa-plus"></i> ACTION_ONE</button>
            <button class="btn btn-primary blue" @*ng-click="vm.doIt2()"*@><i class="fa fa-plus"></i> ACTION_TWO</button>
        </div>
    </div>
    <div class="portlet light">
        <div class="portlet-body">
            <h3>@L("AllBetTypes")</h3>

            <div class="list-group">
                <a href="javascript:;" class="list-group-item" ng-repeat="betType in vm.bettypes">
                    <h4 class="list-group-item-heading">
                        BetTypeCode: 
                        {{betType.BetTypeCode}}
                    </h4>
                    <p class="list-group-item-text">
                        BetTypeName: 
                        {{betType.BetTypeName}}
                    </p> 
                </a>
            </div>

        </div>
    </div>
</div>

Index.js:

<div ng-controller="tenant.views.bet.index as vm">
    <div class="row margin-bottom-5">
        <div class="col-xs-6">
            <div class="page-head">
                <div class="page-title">
                    <h1>
                        <span>@L("Bet")</span>
                    </h1>
                </div>
            </div>
        </div>
        <div class="col-xs-6 text-right">
            <button class="btn btn-primary blue" @*ng-click="vm.doIt1()"*@><i class="fa fa-plus"></i> ACTION_ONE</button>
            <button class="btn btn-primary blue" @*ng-click="vm.doIt2()"*@><i class="fa fa-plus"></i> ACTION_TWO</button>
        </div>
    </div>
    <div class="portlet light">
        <div class="portlet-body">
            <h3>@L("AllBetTypes")</h3>

            <div class="list-group">
                <a href="javascript:;" class="list-group-item" ng-repeat="betType in vm.bettypes">
                    <h4 class="list-group-item-heading">
                        BetTypeCode: 
                        {{betType.BetTypeCode}}
                    </h4>
                    <p class="list-group-item-text">
                        BetTypeName: 
                        {{betType.BetTypeName}}
                    </p> 
                </a>
            </div>

        </div>
    </div>
</div>

Hi!

I'm having difficulties with the get-method in AngularJs. I have followed the step-by-step guide, wich has been very good, but when I apply the instructions on my own project the results does'nt show and I have no idea what is wrong.

This is my js code:

(function () { appModule.controller('tenant.views.bet.index', [ '$scope', 'abp.services.app.tenantBetType', function ($scope, tenantBetTypeService) { var vm = this;

        $scope.$on('$viewContentLoaded', function () {
            Metronic.initAjax();
        });//this part doesnt exist in the tutorial but it does in the other views in my project so I just assumed it should be                 //there.

        vm.getBetTypes = [];

        tenantBetTypeService.getBetTypes({}).success(function (result) {
            vm.betTypes = result.items;
        });


        //...
    }
]);

And here is my cshtml code:

<div ng-controller="tenant.views.bet.index as vm"> <div class="row margin-bottom-5"> <div class="col-xs-6"> <div class="page-head"> <div class="page-title"> <h1> <span>@L("Bet")</span> </h1> </div> </div> </div> <div class="col-xs-6 text-right"> <button class="btn btn-primary blue" @ng-click="vm.doIt1()"@><i class="fa fa-plus"></i> ACTION_ONE</button> <button class="btn btn-primary blue" @ng-click="vm.doIt2()"@><i class="fa fa-plus"></i> ACTION_TWO</button> </div> </div> <div class="portlet light"> <div class="portlet-body"> <h3>@L("AllBetTypes")</h3>

        &lt;div class=&quot;list-group&quot;&gt;
            &lt;a href=&quot;javascript:;&quot; class=&quot;list-group-item&quot; ng-repeat=&quot;betType in vm.betTypes&quot;&gt;
                &lt;h4 class=&quot;list-group-item-heading&quot;&gt;
                    {{betType.BetTypeCode}} {{betType.BetTypeName}}  //the attributes i want to call
                &lt;/h4&gt;
            &lt;/a&gt;
        &lt;/div&gt;

    &lt;/div&gt;
&lt;/div&gt;

</div>

Hi!

I just tried to add a localization xml file, I changed the current default localization filename to sitename-en.xml and named the new xml file to just* sitename*.xml. Then I added the language in the webmodule.cs just as described + setting it to true.

See below: <span style="color:#0000FF">_public override void PreInitialize() { //Add/remove languages for your application Configuration.Localization.Languages.Add(new LanguageInfo("sv-SE", "Swedish", "famfamfam-flag-sv", true)); Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flag-gb"));

        //Configure navigation/menu
        Configuration.Navigation.Providers.Add&lt;AppNavigationProvider&gt;();
    }_&lt;/span&gt;

Problem: When I run the application I get the following message:

<span style="color:#BF0000">_An exception of type 'Abp.AbpInitializationException' occurred in Abp.dll but was not handled in user code

Additional information: There should be a default localization dictionary for source: SiteName_</span>

Anyone know how to fix this? I cant find where I set a Localization-file to default :/

Mvh Julian

Showing 1 to 3 of 3 entries